Skip to content

Commit

Permalink
ci: add dry-run flag to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Dec 7, 2024
1 parent e295d25 commit d6d3b32
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: true
default: false
type: boolean
dryrun:
description: 'Dry run'
required: false
default: false
type: boolean

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -27,7 +32,7 @@ jobs:
release:
# only run if opt-in during workflow_dispatch
name: 'Release: Publish to NPM'
if: always() && github.event.inputs.release == 'true'
if: always() && (github.event.inputs.release == 'true' || github.event.inputs.dryrun == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -40,11 +45,16 @@ jobs:
node-version: lts/*
cache: npm
- run: npm ci
# Branches that will release new versions are defined in .releaserc.json
- run: npx semantic-release --dry-run
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
# e.g. git tags were pushed but it exited before `npm publish`
if: always() && github.event.inputs.dryrun == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npx semantic-release
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
# e.g. git tags were pushed but it exited before `npm publish`
if: always()
if: always() && github.event.inputs.dryrun == 'false' && github.event.inputs.release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

0 comments on commit d6d3b32

Please sign in to comment.