@@ -2,14 +2,26 @@ name: Release
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ version :
7+ description : >-
8+ Existing version tag to re-publish (e.g. v0.200.0).
9+ Leave empty to bump and release a new version.
10+ required : false
511
612jobs :
713 release :
8- if : github.ref == 'refs/heads/main'
14+ # This workflow should always be run on main - this is enforced by the
15+ # `release` environment directly but added here for visibility.
16+ # If the workflow fails during publishing, run a new workflow
17+ # with the `version` that needs to be published.
18+ if : github.ref == 'refs/heads/main' && github.run_attempt == '1'
19+
920 runs-on : ubuntu-latest
1021 environment : release
1122 permissions :
1223 contents : read
24+
1325 steps :
1426 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1527 with :
@@ -22,16 +34,30 @@ jobs:
2234 git config user.name "planetscale-actions-bot"
2335 git config user.email "60239337+planetscale-actions-bot@users.noreply.github.com"
2436
37+ - name : Checkout existing tag
38+ if : inputs.version != ''
39+ run : git checkout "refs/tags/$VERSION"
40+ env :
41+ VERSION : ${{ inputs.version }}
42+
2543 - name : Bump version and push tag
44+ if : inputs.version == ''
2645 id : bump
2746 env :
2847 GITHUB_TOKEN : ${{ secrets.RELEASE_GITHUB_TOKEN }}
2948 run : script/bump-version.sh
3049
50+ - name : Resolve version
51+ id : version
52+ env :
53+ INPUT_VERSION : ${{ inputs.version }}
54+ BUMP_VERSION : ${{ steps.bump.outputs.RELEASE_VERSION }}
55+ run : echo "TAG=${INPUT_VERSION:-$BUMP_VERSION}" >> "$GITHUB_OUTPUT"
56+
3157 - name : Publish artifacts
3258 env :
3359 GITHUB_TOKEN : ${{ secrets.RELEASE_GITHUB_TOKEN }}
34- GORELEASER_CURRENT_TAG : ${{ steps.bump .outputs.RELEASE_VERSION }}
60+ GORELEASER_CURRENT_TAG : ${{ steps.version .outputs.TAG }}
3561 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
3662 DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
3763 AUR_KEY : ${{ secrets.AUR_KEY }}
0 commit comments