Skip to content

Commit b7efa03

Browse files
authored
Merge pull request #438 from supabase/rs/fix-homebrew-release
fix: generate short-lived token to create PRs in homebrew and scoop repos
2 parents f51a4c2 + 998fd30 commit b7efa03

4 files changed

Lines changed: 48 additions & 16 deletions

File tree

‎.github/workflows/manual-release-brew-and-scoop.yaml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ jobs:
1515
uses: ./.github/workflows/release-homebrew-tap.yaml
1616
with:
1717
tag: ${{ github.event.inputs.tag }}
18-
secrets:
19-
homebrew_tap_rw: ${{ secrets.HOMEBREW_TAP_RW }}
18+
secrets: inherit
2019

2120
call-release-scoop-bucket:
2221
uses: ./.github/workflows/release-scoop-bucket.yaml
2322
with:
2423
tag: ${{ github.event.inputs.tag }}
25-
secrets:
26-
scoop_bucket_rw: ${{ secrets.SCOOP_BUCKET_RW }}
24+
secrets: inherit

‎.github/workflows/release-cli.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,20 @@ jobs:
186186
asset_path: ./cli/target/release/dbdev.zip
187187
asset_name: dbdev-${{ github.ref_name }}-windows-amd64.zip
188188
asset_content_type: application/zip
189+
190+
release-homebrew-tap:
191+
needs:
192+
- build-linux
193+
- build-macos
194+
uses: ./.github/workflows/release-homebrew-tap.yaml
195+
with:
196+
tag: ${{ github.ref_name }}
197+
secrets: inherit
198+
199+
release-scoop-bucket:
200+
needs:
201+
- build-windows
202+
uses: ./.github/workflows/release-scoop-bucket.yaml
203+
with:
204+
tag: ${{ github.ref_name }}
205+
secrets: inherit

‎.github/workflows/release-homebrew-tap.yaml‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
tag:
77
required: true
88
type: string
9-
secrets:
10-
homebrew_tap_rw:
11-
required: true
129

1310
permissions:
1411
contents: write
@@ -17,19 +14,31 @@ jobs:
1714
release:
1815
runs-on: ubuntu-latest
1916
steps:
20-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
- name: Generate GitHub App Token
18+
id: app-token
19+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
20+
with:
21+
app-id: ${{ vars.GH_APP_ID }}
22+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
23+
owner: supabase
24+
repositories: homebrew-tap
25+
26+
- name: Checkout homebrew-tap repository
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2128
with:
2229
repository: supabase/homebrew-tap
2330
ref: "main"
24-
token: ${{ secrets.homebrew_tap_rw }}
31+
token: ${{ steps.app-token.outputs.token }}
2532
fetch-depth: 0
33+
2634
- name: Compute tag and version
2735
id: vars
2836
run: |
2937
tag="${{ inputs.tag }}"
3038
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
3139
# strip the leading v (if present)
3240
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
41+
3342
- name: Download Linux AMD64 package
3443
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1
3544
with:
@@ -50,6 +59,7 @@ jobs:
5059
repository: "supabase/dbdev"
5160
tag: ${{ inputs.tag }}
5261
fileName: "dbdev-${{ inputs.tag }}-macos-arm64.tar.gz"
62+
5363
- name: Generate Manifest File
5464
run: |
5565
linux_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-linux-amd64.tar.gz | cut -d" " -f1`
@@ -115,7 +125,7 @@ jobs:
115125
- name: Create Pull Request
116126
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
117127
with:
118-
token: ${{ secrets.homebrew_tap_rw }}
128+
token: ${{ steps.app-token.outputs.token }}
119129
commit-message: "Release dbdev version v${{ steps.vars.outputs.version }}"
120130
title: "Release dbdev version v${{ steps.vars.outputs.version }}"
121131
body-path: PR_BODY.md

‎.github/workflows/release-scoop-bucket.yaml‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
tag:
77
required: true
88
type: string
9-
secrets:
10-
scoop_bucket_rw:
11-
required: true
129

1310
permissions:
1411
contents: write
@@ -17,11 +14,21 @@ jobs:
1714
release:
1815
runs-on: ubuntu-latest
1916
steps:
20-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
- name: Generate GitHub App Token
18+
id: app-token
19+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
20+
with:
21+
app-id: ${{ vars.GH_APP_ID }}
22+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
23+
owner: supabase
24+
repositories: scoop-bucket
25+
26+
- name: Checkout scoop-bucket repository
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2128
with:
2229
repository: supabase/scoop-bucket
2330
ref: "main"
24-
token: ${{ secrets.scoop_bucket_rw }}
31+
token: ${{ steps.app-token.outputs.token }}
2532
fetch-depth: 0
2633

2734
- name: Compute tag and version
@@ -71,7 +78,7 @@ jobs:
7178
- name: Create Pull Request
7279
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
7380
with:
74-
token: ${{ secrets.scoop_bucket_rw }}
81+
token: ${{ steps.app-token.outputs.token }}
7582
commit-message: "Release dbdev version v${{ steps.vars.outputs.version }}"
7683
title: "Release dbdev version v${{ steps.vars.outputs.version }}"
7784
body-path: PR_BODY.md

0 commit comments

Comments
 (0)