Skip to content

Commit e775639

Browse files
authored
ci: automate releases with release-please (#521)
1 parent 46f217a commit e775639

File tree

10 files changed

+269
-193
lines changed

10 files changed

+269
-193
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- macos-latest
16+
- ubuntu-latest
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
- name: Use Node.js 16.x
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 16.x
28+
29+
- name: Get yarn cache directory path
30+
id: yarn-cache-dir-path
31+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
32+
- name: Retrieve yarn cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
36+
key: v1-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
37+
restore-keys: |
38+
v1-${{ runner.os }}-yarn-
39+
40+
- name: Install npm packages
41+
run: yarn --frozen-lockfile
42+
43+
- name: Ensure out directories are up-to-date
44+
if: runner.os == 'Linux'
45+
shell: bash
46+
run: |
47+
yarn build
48+
if [ "$(git status --porcelain | wc -l)" -gt "0" ]; then
49+
echo "Detected uncommitted changes after build. See status below:"
50+
git diff
51+
exit 1
52+
fi

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CodeQL
1+
name: codeql
22

33
on:
44
- pull_request

.github/workflows/lint.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
eslint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 16.x
17+
- name: Get yarn cache directory path
18+
id: yarn-cache-dir-path
19+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
20+
- name: Install npm packages
21+
run: yarn --frozen-lockfile
22+
- name: Check lint
23+
run: yarn lint
24+
25+
prettier:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-node@v3
30+
with:
31+
node-version: 16.x
32+
- name: Get yarn cache directory path
33+
id: yarn-cache-dir-path
34+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
35+
- name: Install npm packages
36+
run: yarn --frozen-lockfile
37+
- name: Check formatting
38+
run: yarn fmt:check
39+
40+
typecheck:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
- uses: actions/setup-node@v3
45+
with:
46+
node-version: 16.x
47+
- name: Get yarn cache directory path
48+
id: yarn-cache-dir-path
49+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
50+
- name: Install npm packages
51+
run: yarn --frozen-lockfile
52+
- name: Check types
53+
run: yarn typecheck
54+
55+
actionlint:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v3
60+
61+
- name: Check workflow files
62+
uses: docker://rhysd/actionlint:1.6.23
63+
with:
64+
args: -color

.github/workflows/release.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: google-github-actions/release-please-action@v3
17+
id: release
18+
with:
19+
release-type: node
20+
command: github-release
21+
# extra-files: |
22+
# README.md
23+
- uses: actions/checkout@v2
24+
- name: tag major versions
25+
if: ${{ steps.release.outputs.release_created }}
26+
run: |
27+
git config user.name github-actions[bot]
28+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
29+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
30+
git tag -d v${{ steps.release.outputs.major }} || true
31+
git push origin :v${{ steps.release.outputs.major }} || true
32+
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
33+
git push origin v${{ steps.release.outputs.major }}

.github/workflows/semantic-pr.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: lint
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
semantic-pr:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5.1.0
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
with:
18+
validateSingleCommit: true

.github/workflows/test.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
asdf_is_installed:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: ["macos-latest", "ubuntu-latest"]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: setup asdf
19+
uses: ./setup
20+
- name: asdf is available
21+
run: |
22+
echo ASDF_DIR="${ASDF_DIR}"
23+
echo ASDF_DATA_DIR="${ASDF_DATA_DIR}"
24+
echo PATH="${PATH}"
25+
asdf --version
26+
27+
plugin_is_tested:
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: ["macos-latest", "ubuntu-latest"]
32+
runs-on: ${{ matrix.os }}
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: ./plugin-test
36+
with:
37+
command: direnv --version
38+
plugin: direnv
39+
giturl: https://github.com/asdf-community/asdf-direnv.git
40+
gitref: master
41+
42+
plugins_are_installed:
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: ["macos-latest", "ubuntu-latest"]
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- uses: actions/checkout@v3
50+
- uses: ./plugins-add
51+
with:
52+
tool_versions: |
53+
# tools won't be installed by this action, only plugins
54+
elixir foo
55+
nodejs bar
56+
- run: |
57+
asdf plugin list --urls --refs | grep elixir
58+
asdf plugin list --urls --refs | grep nodejs
59+
60+
installing-plugins-already-installed-are-skiped:
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
os: ["macos-latest", "ubuntu-latest"]
65+
runs-on: ${{ matrix.os }}
66+
steps:
67+
- uses: actions/checkout@v3
68+
- uses: ./setup
69+
- name: Add an asdf plugin
70+
run: |
71+
asdf plugin-add clusterctl https://github.com/pfnet-research/asdf-clusterctl.git
72+
- uses: ./plugins-add
73+
with:
74+
tool_versions: |
75+
# tools won't be installed by this action, only plugins
76+
elixir foo
77+
nodejs bar
78+
# plugins already installed are here
79+
clusterctl tako
80+
- run: |
81+
asdf plugin list --urls --refs | grep elixir
82+
asdf plugin list --urls --refs | grep nodejs
83+
asdf plugin list --urls --refs | grep clusterctl
84+
85+
tools_are_installed:
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
os: ["macos-latest", "ubuntu-latest"]
90+
runs-on: ${{ matrix.os }}
91+
steps:
92+
- uses: actions/checkout@v3
93+
- name: setup asdf
94+
uses: ./install
95+
with:
96+
before_install: echo asdf nodejs import-keyring
97+
tool_versions: direnv 2.32.1
98+
- run: direnv version

0 commit comments

Comments
 (0)