Skip to content

Commit 1d1f656

Browse files
committed
chore: refactor release workflow
1 parent add717f commit 1d1f656

File tree

3 files changed

+19
-36
lines changed

3 files changed

+19
-36
lines changed

.github/workflows/automerge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
with:
2929
app-id: ${{ secrets.APP_ID }}
3030
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
31+
3132
# Here the PR gets approved.
3233
- name: Approve a PR
3334
if: ${{ steps.meta.outputs.update-type == 'version-update:semver-patch' || (!startsWith(steps.meta.outputs.previous-version, '0.') && steps.meta.outputs.update-type == 'version-update:semver-minor') }}

.github/workflows/release-beta.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
permissions:
1010
contents: write
11-
id-token: write
1211

1312
jobs:
1413
release:
@@ -66,18 +65,18 @@ jobs:
6665
if: needs.release.outputs.new-release-published == 'true'
6766
runs-on: ubuntu-latest
6867
steps:
68+
- uses: actions/checkout@v6
69+
- uses: actions/setup-go@v6
70+
with:
71+
go-version-file: go.mod
72+
cache: true
6973
# use GitHub app to create a release token that can publish to homebrew-tap and scoop
7074
- name: Generate token
7175
id: app-token
7276
uses: actions/create-github-app-token@v2
7377
with:
7478
app-id: ${{ secrets.APP_ID }}
7579
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
76-
- uses: actions/checkout@v6
77-
- uses: actions/setup-go@v6
78-
with:
79-
go-version-file: go.mod
80-
cache: true
8180
- run: go run tools/publish/main.go --beta "${{ needs.release.outputs.new-release-version }}"
8281
env:
8382
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

.github/workflows/release.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
permissions:
1010
contents: write
1111
packages: write
12-
id-token: write
1312

1413
jobs:
1514
settings:
@@ -18,35 +17,34 @@ jobs:
1817
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1918
outputs:
2019
release_tag: ${{ steps.prerelease.outputs.tagName }}
20+
app_token: ${{ steps.app-token.outputs.token }}
2121
steps:
2222
- uses: actions/checkout@v6
2323
- id: prerelease
2424
run: |
2525
gh release list --limit 1 --json tagName --jq \
2626
'.[]|to_entries|map("\(.key)=\(.value|tostring)")|.[]' >> $GITHUB_OUTPUT
2727
- run: gh release edit ${{ steps.prerelease.outputs.tagName }} --latest --prerelease=false
28+
- id: app-token
29+
uses: actions/create-github-app-token@v2
30+
with:
31+
app-id: ${{ secrets.APP_ID }}
32+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
2833

2934
commit:
3035
name: Publish Brew and Scoop
3136
needs:
3237
- settings
3338
runs-on: ubuntu-latest
3439
steps:
35-
# use GitHub app to create a release token that can publish to homebrew-tap and scoop
36-
- name: Generate token
37-
id: app-token
38-
uses: actions/create-github-app-token@v2
39-
with:
40-
app-id: ${{ secrets.APP_ID }}
41-
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
4240
- uses: actions/checkout@v6
4341
- uses: actions/setup-go@v6
4442
with:
4543
go-version-file: go.mod
4644
cache: true
4745
- run: go run tools/publish/main.go ${{ needs.settings.outputs.release_tag }}
4846
env:
49-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
47+
GITHUB_TOKEN: ${{ needs.settings.outputs.app_token }}
5048

5149
publish:
5250
name: Publish NPM
@@ -59,44 +57,35 @@ jobs:
5957

6058
compose:
6159
name: Bump self-hosted versions
60+
needs:
61+
- settings
6262
runs-on: ubuntu-latest
6363
steps:
64-
- name: Generate token
65-
id: app-token
66-
uses: actions/create-github-app-token@v2
67-
with:
68-
app-id: ${{ secrets.APP_ID }}
69-
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
7064
- uses: actions/checkout@v6
7165
- uses: actions/setup-go@v6
7266
with:
7367
go-version-file: go.mod
7468
cache: true
7569
- run: go run tools/selfhost/main.go
7670
env:
77-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
71+
GITHUB_TOKEN: ${{ needs.settings.outputs.app_token }}
7872

7973
changelog:
8074
name: Publish changelog
8175
needs:
76+
- settings
8277
- commit
8378
- publish
8479
runs-on: ubuntu-latest
8580
steps:
86-
- name: Generate token
87-
id: app-token
88-
uses: actions/create-github-app-token@v2
89-
with:
90-
app-id: ${{ secrets.APP_ID }}
91-
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
9281
- uses: actions/checkout@v6
9382
- uses: actions/setup-go@v6
9483
with:
9584
go-version-file: go.mod
9685
cache: true
9786
- run: go run tools/changelog/main.go ${{ secrets.SLACK_CHANNEL }}
9887
env:
99-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
88+
GITHUB_TOKEN: ${{ needs.settings.outputs.app_token }}
10089
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
10190

10291
docs:
@@ -105,17 +94,11 @@ jobs:
10594
- settings
10695
runs-on: ubuntu-latest
10796
steps:
108-
- name: Generate token
109-
id: app-token
110-
uses: actions/create-github-app-token@v2
111-
with:
112-
app-id: ${{ secrets.APP_ID }}
113-
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
11497
- uses: actions/checkout@v6
11598
- uses: actions/setup-go@v6
11699
with:
117100
go-version-file: go.mod
118101
cache: true
119102
- run: go run docs/main.go ${{ needs.settings.outputs.release_tag }} | go run tools/bumpdoc/main.go apps/docs/spec/cli_v1_commands.yaml
120103
env:
121-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
104+
GITHUB_TOKEN: ${{ needs.settings.outputs.app_token }}

0 commit comments

Comments
 (0)