@@ -3,6 +3,11 @@ name: Release Please
33on :
44 push :
55 branches : [master]
6+ workflow_dispatch :
7+ inputs :
8+ tag :
9+ description : ' Existing release tag to publish (e.g. v1.10.0)'
10+ required : true
611
712permissions :
813 contents : write
@@ -17,31 +22,51 @@ jobs:
1722 steps :
1823 - uses : googleapis/release-please-action@v4
1924 id : release
25+ if : ${{ github.event_name == 'push' }}
2026 with :
2127 config-file : release-please-config.json
2228 manifest-file : .release-please-manifest.json
2329
30+ - name : Decide publish mode
31+ id : mode
32+ run : |
33+ EVENT_NAME="${{ github.event_name }}"
34+ MANUAL_TAG="${{ github.event.inputs.tag }}"
35+ RELEASE_CREATED="${{ steps.release.outputs.release_created }}"
36+
37+ if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
38+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
39+ echo "checkout_ref=$MANUAL_TAG" >> "$GITHUB_OUTPUT"
40+ elif [ "$RELEASE_CREATED" = "true" ]; then
41+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
42+ echo "checkout_ref=${{ github.sha }}" >> "$GITHUB_OUTPUT"
43+ else
44+ echo "should_publish=false" >> "$GITHUB_OUTPUT"
45+ fi
46+
2447 - uses : actions/checkout@v4
25- if : ${{ steps.release.outputs.release_created }}
48+ if : ${{ steps.mode.outputs.should_publish == 'true' }}
49+ with :
50+ ref : ${{ steps.mode.outputs.checkout_ref }}
2651
2752 - uses : pnpm/action-setup@v2
28- if : ${{ steps.release .outputs.release_created }}
53+ if : ${{ steps.mode .outputs.should_publish == 'true' }}
2954 with :
3055 version : 10
3156
3257 - uses : actions/setup-node@v4
33- if : ${{ steps.release .outputs.release_created }}
58+ if : ${{ steps.mode .outputs.should_publish == 'true' }}
3459 with :
3560 node-version : ' 24'
3661 registry-url : ' https://registry.npmjs.org'
3762 cache : ' pnpm'
3863
3964 - name : Install
40- if : ${{ steps.release .outputs.release_created }}
65+ if : ${{ steps.mode .outputs.should_publish == 'true' }}
4166 run : pnpm install --frozen-lockfile
4267
4368 - name : Check if version already published
44- if : ${{ steps.release .outputs.release_created }}
69+ if : ${{ steps.mode .outputs.should_publish == 'true' }}
4570 run : |
4671 VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).version)")"
4772 if npm view "codebase-context@${VERSION}" version >/dev/null 2>&1; then
5277 fi
5378
5479 - name : Quality gates
55- if : ${{ steps.release .outputs.release_created && env.SKIP_PUBLISH != 'true' }}
80+ if : ${{ steps.mode .outputs.should_publish == 'true' && env.SKIP_PUBLISH != 'true' }}
5681 run : |
5782 pnpm lint
5883 pnpm format:check
6186 pnpm test
6287
6388 - name : Publish to npm with provenance
64- if : ${{ steps.release .outputs.release_created && env.SKIP_PUBLISH != 'true' }}
89+ if : ${{ steps.mode .outputs.should_publish == 'true' && env.SKIP_PUBLISH != 'true' }}
6590 run : pnpm publish --access public --no-git-checks --provenance
0 commit comments