11name : Release
22
33on :
4- push :
5- branches :
6- - main
7- workflow_call :
4+ pull_request_review :
5+ types :
6+ - submitted
87
98permissions :
109 contents : read
1110
1211jobs :
13- settings :
12+ fast-forward :
13+ if : |
14+ github.event.pull_request.head.ref == 'develop' &&
15+ github.event.pull_request.base.ref == 'main' &&
16+ github.event.review.state == 'approved'
1417 runs-on : ubuntu-latest
1518 permissions :
1619 contents : write
1720 packages : write
18- env :
19- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2021 outputs :
21- release_tag : ${{ steps.prerelease .outputs.tagName }}
22+ release_tag : ${{ steps.latest-release .outputs.tagName }}
2223 steps :
2324 - uses : actions/checkout@v6
24- - id : prerelease
25+ with :
26+ fetch-depth : 0
27+ - run : |
28+ git checkout main
29+ git merge --ff-only "${{ github.event.pull_request.head.sha }}"
30+ git push origin main
31+ - id : latest-release
2532 run : |
26- gh release list --limit 1 --json tagName --jq \
27- '.[]|to_entries|map("\(.key)=\(.value|tostring)")|.[]' >> $GITHUB_OUTPUT
28- - run : gh release edit ${{ steps.prerelease.outputs.tagName }} --latest --prerelease=false
33+ latest=$(gh release list --limit 1 --json tagName --jq '.[].tagName')
34+ gh release edit $latest --latest --prerelease=false
35+ echo "tagName=$latest" >> $GITHUB_OUTPUT
36+ env :
37+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2938
3039 commit :
3140 name : Publish Brew and Scoop
3241 needs :
33- - settings
42+ - fast-forward
3443 runs-on : ubuntu-latest
3544 steps :
3645 - uses : actions/checkout@v6
@@ -47,26 +56,26 @@ jobs:
4756 repositories : |
4857 homebrew-tap
4958 scoop-bucket
50- - run : go run tools/publish/main.go ${{ needs.settings .outputs.release_tag }}
59+ - run : go run tools/publish/main.go ${{ needs.fast-forward .outputs.release_tag }}
5160 env :
5261 GITHUB_TOKEN : ${{ steps.app-token.outputs.token }}
5362
5463 publish :
5564 name : Publish NPM
5665 needs :
57- - settings
66+ - fast-forward
5867 permissions :
5968 contents : read
6069 id-token : write
6170 uses : ./.github/workflows/tag-npm.yml
6271 with :
63- release : ${{ needs.settings .outputs.release_tag }}
72+ release : ${{ needs.fast-forward .outputs.release_tag }}
6473 secrets : inherit
6574
6675 compose :
6776 name : Bump self-hosted versions
6877 needs :
69- - settings
78+ - fast-forward
7079 runs-on : ubuntu-latest
7180 steps :
7281 - uses : actions/checkout@v6
8998 changelog :
9099 name : Publish changelog
91100 needs :
92- - settings
101+ - fast-forward
93102 - commit
94103 - publish
95104 runs-on : ubuntu-latest
@@ -115,7 +124,7 @@ jobs:
115124 docs :
116125 name : Publish reference docs
117126 needs :
118- - settings
127+ - fast-forward
119128 runs-on : ubuntu-latest
120129 steps :
121130 - uses : actions/checkout@v6
@@ -131,6 +140,6 @@ jobs:
131140 owner : ${{ github.repository_owner }}
132141 repositories : |
133142 supabase
134- - run : go run docs/main.go ${{ needs.settings .outputs.release_tag }} | go run tools/bumpdoc/main.go apps/docs/spec/cli_v1_commands.yaml
143+ - run : go run docs/main.go ${{ needs.fast-forward .outputs.release_tag }} | go run tools/bumpdoc/main.go apps/docs/spec/cli_v1_commands.yaml
135144 env :
136145 GITHUB_TOKEN : ${{ steps.app-token.outputs.token }}
0 commit comments