Skip to content

Commit 97b9dbc

Browse files
committed
Update reusable release workflow
1 parent b78d17e commit 97b9dbc

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.github/workflows/reusable-release-advanced.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ on:
4646
required: false
4747
default: ""
4848
type: string
49+
skip-publish:
50+
description: "Create and prepare release but skip publish/tag/branch updates"
51+
required: false
52+
default: false
53+
type: boolean
4954
publish-no-latest-on-non-main:
5055
description: "Pass --no-latest on non-main branch releases"
5156
required: false
@@ -165,14 +170,15 @@ jobs:
165170
run: ${{ inputs.post-create }}
166171

167172
- name: Run pre-publish script
168-
if: inputs.pre-publish != ''
173+
if: ${{ inputs.pre-publish != '' && !inputs['skip-publish'] }}
169174
run: ${{ inputs.pre-publish }}
170175
env:
171176
CHANGELOG_ROOT: ${{ inputs.changelog-root }}
172177
RELEASE_VERSION: ${{ steps.create-release.outputs.version }}
173178
GH_TOKEN: ${{ steps.app-token.outputs.token }}
174179

175180
- name: Stage and publish
181+
if: ${{ !inputs['skip-publish'] }}
176182
run: |
177183
git add "$CHANGELOG_ROOT/changelog"
178184
if [ -n "$GIT_ADD_PATHS" ]; then
@@ -192,7 +198,7 @@ jobs:
192198
GH_TOKEN: ${{ steps.app-token.outputs.token }}
193199

194200
- name: Copy release to main branch (non-main release)
195-
if: inputs.copy-release-to-main-on-non-main && steps.release-type.outputs.is_latest == 'false'
201+
if: ${{ !inputs['skip-publish'] && inputs.copy-release-to-main-on-non-main && steps.release-type.outputs.is_latest == 'false' }}
196202
run: |
197203
RELEASE_DIR="$CHANGELOG_ROOT/changelog/releases/$RELEASE_VERSION"
198204
TMP_DIR="$(mktemp -d)"
@@ -213,13 +219,13 @@ jobs:
213219
RELEASE_VERSION: ${{ steps.create-release.outputs.version }}
214220

215221
- name: Update latest branch
216-
if: inputs.update-latest-branch-on-main && steps.release-type.outputs.is_latest == 'true'
222+
if: ${{ !inputs['skip-publish'] && inputs.update-latest-branch-on-main && steps.release-type.outputs.is_latest == 'true' }}
217223
run: |
218224
git checkout -B latest
219225
git push origin latest --force
220226
221227
- name: Run post-publish script
222-
if: inputs.post-publish != ''
228+
if: ${{ inputs.post-publish != '' && !inputs['skip-publish'] }}
223229
run: ${{ inputs.post-publish }}
224230
env:
225231
CHANGELOG_ROOT: ${{ inputs.changelog-root }}
@@ -238,4 +244,5 @@ jobs:
238244
echo ""
239245
echo "- Branch: \`${GITHUB_REF_NAME}\`"
240246
echo "- Latest release: \`${IS_LATEST}\`"
247+
echo "- Publish skipped: \`${{ inputs['skip-publish'] }}\`"
241248
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/reusable-release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
post-create: ${{ inputs.post-create }}
5858
pre-publish: ""
5959
post-publish: ""
60+
skip-publish: false
6061
publish-no-latest-on-non-main: false
6162
copy-release-to-main-on-non-main: false
6263
update-latest-branch-on-main: false

changelog/unreleased/split-reusable-release-workflow-into-minimal-and-advanced-variants.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ created: 2026-02-16T15:47:58Z
1212

1313
The advanced workflow adds optional hooks and release controls for complex
1414
consumers: pre/post publish scripts, non-main `--no-latest` publishing,
15-
optional copy of release directories to `main`, `latest` branch updates, and
16-
workflow outputs for `version` and `is_latest`.
15+
optional copy of release directories to `main`, `latest` branch updates, a
16+
`skip-publish` dry-run mode, and workflow outputs for `version` and
17+
`is_latest`.

0 commit comments

Comments
 (0)