From 4f44ec25021067b21c480a2335bbfbcbe327566e Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Sat, 7 Dec 2024 10:38:45 -0800 Subject: [PATCH] ci: add dry-run flag to release workflow --- .github/workflows/release.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e6f628..61c717b 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 }} @@ -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' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}