Skip to content

Commit 0789607

Browse files
committed
ci: default release workflow to dry-run with decision summary
1 parent 08bb666 commit 0789607

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/release-on-main.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
release:
1818
runs-on: ubuntu-latest
1919
if: ${{ !contains(github.event.head_commit.message, '[skip release]') }}
20+
env:
21+
RELEASE_DRY_RUN: ${{ vars.RELEASE_DRY_RUN || 'true' }}
2022
steps:
2123
- name: Checkout
2224
uses: actions/checkout@v4
@@ -28,6 +30,14 @@ jobs:
2830
with:
2931
node-version: "22"
3032

33+
- name: Resolve dry-run mode
34+
id: dryrun
35+
run: |
36+
case "${RELEASE_DRY_RUN,,}" in
37+
1|true|yes|on) echo "enabled=true" >> "$GITHUB_OUTPUT" ;;
38+
*) echo "enabled=false" >> "$GITHUB_OUTPUT" ;;
39+
esac
40+
3141
- name: Determine last release tag
3242
id: last_tag
3343
run: |
@@ -187,7 +197,7 @@ EOF
187197
echo "tag=v${NEXT}" >> "$GITHUB_OUTPUT"
188198
189199
- name: Check tag does not already exist
190-
if: steps.bump.outputs.tag != ''
200+
if: steps.bump.outputs.tag != '' && steps.dryrun.outputs.enabled != 'true'
191201
env:
192202
TAG: ${{ steps.bump.outputs.tag }}
193203
run: |
@@ -197,7 +207,7 @@ EOF
197207
fi
198208
199209
- name: Commit and tag
200-
if: steps.bump.outputs.tag != ''
210+
if: steps.bump.outputs.tag != '' && steps.dryrun.outputs.enabled != 'true' && steps.dryrun.outputs.enabled != 'true'
201211
env:
202212
TAG: ${{ steps.bump.outputs.tag }}
203213
run: |
@@ -233,7 +243,7 @@ EOF
233243
echo "notes_path=/tmp/release-notes.md" >> "$GITHUB_OUTPUT"
234244
235245
- name: Create GitHub Release
236-
if: steps.bump.outputs.tag != ''
246+
if: steps.bump.outputs.tag != '' && steps.dryrun.outputs.enabled != 'true'
237247
env:
238248
GH_TOKEN: ${{ github.token }}
239249
TAG: ${{ steps.bump.outputs.tag }}
@@ -253,3 +263,13 @@ EOF
253263
echo "Tag: ${{ steps.bump.outputs.tag }}" >> "$GITHUB_STEP_SUMMARY"
254264
echo "Decision: ${{ steps.decide.outputs.decision }}" >> "$GITHUB_STEP_SUMMARY"
255265
echo "Reason: ${{ steps.decide.outputs.reason }}" >> "$GITHUB_STEP_SUMMARY"
266+
267+
- name: Dry-run release summary
268+
if: steps.bump.outputs.tag != "" && steps.dryrun.outputs.enabled == "true"
269+
run: |
270+
echo "## Dry run: no release published" >> "$GITHUB_STEP_SUMMARY"
271+
echo "Decision: ${{ steps.decide.outputs.decision }}" >> "$GITHUB_STEP_SUMMARY"
272+
echo "Reason: ${{ steps.decide.outputs.reason }}" >> "$GITHUB_STEP_SUMMARY"
273+
echo "Current version: ${{ steps.bump.outputs.current }}" >> "$GITHUB_STEP_SUMMARY"
274+
echo "Would publish tag: ${{ steps.bump.outputs.tag }}" >> "$GITHUB_STEP_SUMMARY"
275+

0 commit comments

Comments
 (0)