diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e6f628..988cd96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} @@ -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 @@ -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 }}