Skip to content

Commit 8cbcbbc

Browse files
authored
ci: use app token for goreleaser homebrew formula push (#19)
1 parent 488de00 commit 8cbcbbc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/release-binaries.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
release:
1111
runs-on: ubuntu-latest
1212
permissions:
13-
contents: write # goreleaser uploads release assets
13+
contents: read
1414
packages: write # push images to ghcr.io
1515

1616
steps:
@@ -28,11 +28,21 @@ jobs:
2828
username: ${{ github.actor }}
2929
password: ${{ secrets.GITHUB_TOKEN }}
3030

31+
# goreleaser uploads release assets and commits the updated Homebrew
32+
# formula directly to the protected main branch, so it needs an app
33+
# token (the app is in the branch protection bypass list).
34+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
35+
id: app-token
36+
with:
37+
client-id: ${{ secrets.RELEASE_BOT_APP_ID }}
38+
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
39+
permission-contents: write
40+
3141
- name: Run GoReleaser
3242
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
3343
with:
3444
distribution: goreleaser
3545
version: '~> v2'
3646
args: release --clean --skip=validate
3747
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

0 commit comments

Comments
 (0)