Skip to content

Commit 1745884

Browse files
authored
feat: init ssh action(#1)
* project init * remove entrypoint * add space * add space * review fixes * action update * change workflows * remove access token flag * review update * put ssh keys to env * add basic readme * update 3 * update 4 * update 5 * update 6 * update 7 * update 8 * update 9 * update 10 * update 11 * update 11 * update 12 * update 13 * add unit tests * add label/release workflows * update ssh key reding * update review nits * update comments
1 parent a4be85e commit 1745884

File tree

24 files changed

+21203
-0
lines changed

24 files changed

+21203
-0
lines changed

.eslintrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the 'License');
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an 'AS IS' BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
root: true,
19+
parser: '@typescript-eslint/parser',
20+
plugins: ['@typescript-eslint'],
21+
extends: [
22+
'eslint:recommended',
23+
'plugin:@typescript-eslint/eslint-recommended',
24+
'plugin:@typescript-eslint/recommended',
25+
'plugin:prettier/recommended',
26+
],
27+
rules: {
28+
'@typescript-eslint/camelcase': 'off',
29+
'@typescript-eslint/no-non-null-assertion': 'off',
30+
}
31+
};

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm"
9+
directory: "/"
10+
commit-message:
11+
prefix: "chore(deps): "
12+
rebase-strategy: "disabled"
13+
schedule:
14+
interval: "daily"
15+
ignore:
16+
- dependency-name: "*"
17+
update-types: ["version-update:semver-patch", "version-update:semver-minor"] # Security updates are unaffected by this setting
18+
19+
- package-ecosystem: "npm"
20+
directory: "/example-app"
21+
commit-message:
22+
prefix: "chore(deps): "
23+
schedule:
24+
interval: "monthly"

.github/workflows/label.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: 'label'
16+
17+
on: 'pull_request_target'
18+
19+
jobs:
20+
apply-label:
21+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
22+
runs-on: 'ubuntu-latest'
23+
steps:
24+
- uses: 'actions/github-script@v3'
25+
with:
26+
github-token: '${{ secrets.GITHUB_TOKEN }}'
27+
script: |-
28+
github.issues.addLabels({
29+
issue_number: context.issue.number,
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
labels: ['Fork']
33+
})

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: 'release'
16+
17+
on:
18+
push:
19+
branches:
20+
- 'main'
21+
workflow_dispatch:
22+
23+
jobs:
24+
# build compiles the code and creates a pull request of the compiled result if
25+
# there is a diff.
26+
build:
27+
runs-on: 'ubuntu-latest'
28+
steps:
29+
- uses: 'actions/checkout@v3'
30+
31+
- uses: 'actions/setup-node@v3'
32+
with:
33+
node-version: '16.x'
34+
35+
- name: 'npm build'
36+
run: 'npm ci && npm run build'
37+
38+
- name: 'Create pull request'
39+
uses: 'peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a'
40+
with:
41+
token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
42+
add-paths: 'dist/'
43+
committer: 'google-github-actions-bot <github-actions-bot@google.com>'
44+
author: 'google-github-actions-bot <github-actions-bot@google.com>'
45+
signoff: 'google-github-actions-bot <github-actions-bot@google.com>'
46+
commit-message: 'Build dist'
47+
title: 'chore: build dist'
48+
body: 'Build compiled Typescript'
49+
base: 'main'
50+
branch: 'actions/build'
51+
push-to-fork: 'google-github-actions-bot/ssh-compute'
52+
delete-branch: true
53+
54+
# create-pull-request creates a release pull request if there are any
55+
# convential commit changes since the last release.
56+
create-pull-request:
57+
runs-on: 'ubuntu-latest'
58+
steps:
59+
- uses: 'google-github-actions/release-please-action@v2'
60+
with:
61+
token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
62+
release-type: 'node'
63+
bump-minor-pre-major: true
64+
command: 'release-pr'
65+
fork: true
66+
67+
# release does a release on the merge of the release pull request. It also
68+
# updates the floating tag alias for the major version.
69+
release:
70+
runs-on: 'ubuntu-latest'
71+
steps:
72+
- id: 'release'
73+
uses: 'google-github-actions/release-please-action@v2'
74+
with:
75+
release-type: 'node'
76+
bump-minor-pre-major: true
77+
command: 'github-release'
78+
79+
- name: 'Update floating tag'
80+
if: '${{ steps.release.outputs.release_created }}'
81+
uses: 'actions/github-script@v5'
82+
with:
83+
script: |-
84+
const sha = '${{ steps.release.outputs.sha }}'
85+
const major = 'v${{ steps.release.outputs.major }}';
86+
// Try to update the ref first. If that fails, it probably does not
87+
// exist yet, and we should create it.
88+
try {
89+
await github.rest.git.updateRef({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
ref: `tags/${major}`,
93+
sha: sha,
94+
force: true,
95+
});
96+
core.info(`Updated ${major} to ${sha}`);
97+
} catch(err) {
98+
core.warning(`Failed to create ${major}: ${err}`);
99+
await github.rest.git.createRef({
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
ref: `refs/tags/${major}`,
103+
sha: sha,
104+
});
105+
core.info(`Created ${major} at ${sha}`);
106+
}

.github/workflows/unit.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: 'unit'
16+
17+
on:
18+
push:
19+
branches:
20+
- 'main'
21+
pull_request:
22+
branches:
23+
- 'main'
24+
workflow_dispatch:
25+
26+
concurrency:
27+
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
28+
cancel-in-progress: true
29+
30+
jobs:
31+
run:
32+
name: 'unit'
33+
runs-on: '${{ matrix.os }}'
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
os:
38+
- 'ubuntu-latest'
39+
- 'windows-latest'
40+
- 'macos-latest'
41+
steps:
42+
- uses: 'actions/checkout@v3'
43+
44+
- uses: 'actions/setup-node@v3'
45+
with:
46+
node-version: '16.x'
47+
48+
- name: 'npm build'
49+
run: 'npm ci && npm run build'
50+
51+
- name: 'npm lint'
52+
# There's no need to run the linter for each operating system, since it
53+
# will find the same thing 3x and clog up the PR review.
54+
if: ${{matrix.os == 'ubuntu-latest'}}
55+
run: 'npm run lint'
56+
57+
- name: 'npm test'
58+
run: npm run test

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
node_modules/
2+
runner/
3+
4+
# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# TypeScript v1 declaration files
30+
typings/
31+
32+
# TypeScript cache
33+
*.tsbuildinfo
34+
35+
# Optional npm cache directory
36+
.npm
37+
38+
# Optional eslint cache
39+
.eslintcache
40+
41+
# Optional REPL history
42+
.node_repl_history
43+
44+
# Output of 'npm pack'
45+
*.tgz

.prettierrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
arrowParens: 'always',
19+
bracketSpacing: true,
20+
endOfLine: 'auto',
21+
jsxSingleQuote: true,
22+
printWidth: 100,
23+
quoteProps: 'consistent',
24+
semi: true,
25+
singleQuote: true,
26+
tabWidth: 2,
27+
trailingComma: 'all',
28+
useTabs: false,
29+
};

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @google-github-actions/maintainers

0 commit comments

Comments
 (0)