|
17 | 17 | release: |
18 | 18 | runs-on: ubuntu-latest |
19 | 19 | if: ${{ !contains(github.event.head_commit.message, '[skip release]') }} |
| 20 | + env: |
| 21 | + RELEASE_DRY_RUN: ${{ vars.RELEASE_DRY_RUN || 'true' }} |
20 | 22 | steps: |
21 | 23 | - name: Checkout |
22 | 24 | uses: actions/checkout@v4 |
|
28 | 30 | with: |
29 | 31 | node-version: "22" |
30 | 32 |
|
| 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 | +
|
31 | 41 | - name: Determine last release tag |
32 | 42 | id: last_tag |
33 | 43 | run: | |
|
187 | 197 | echo "tag=v${NEXT}" >> "$GITHUB_OUTPUT" |
188 | 198 |
|
189 | 199 | - name: Check tag does not already exist |
190 | | - if: steps.bump.outputs.tag != '' |
| 200 | + if: steps.bump.outputs.tag != '' && steps.dryrun.outputs.enabled != 'true' |
191 | 201 | env: |
192 | 202 | TAG: ${{ steps.bump.outputs.tag }} |
193 | 203 | run: | |
|
197 | 207 | fi |
198 | 208 |
|
199 | 209 | - 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' |
201 | 211 | env: |
202 | 212 | TAG: ${{ steps.bump.outputs.tag }} |
203 | 213 | run: | |
|
233 | 243 | echo "notes_path=/tmp/release-notes.md" >> "$GITHUB_OUTPUT" |
234 | 244 |
|
235 | 245 | - name: Create GitHub Release |
236 | | - if: steps.bump.outputs.tag != '' |
| 246 | + if: steps.bump.outputs.tag != '' && steps.dryrun.outputs.enabled != 'true' |
237 | 247 | env: |
238 | 248 | GH_TOKEN: ${{ github.token }} |
239 | 249 | TAG: ${{ steps.bump.outputs.tag }} |
|
253 | 263 | echo "Tag: ${{ steps.bump.outputs.tag }}" >> "$GITHUB_STEP_SUMMARY" |
254 | 264 | echo "Decision: ${{ steps.decide.outputs.decision }}" >> "$GITHUB_STEP_SUMMARY" |
255 | 265 | 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