Skip to content

Commit

Permalink
ci: safely publish pre-releases on workflow dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ebr committed Jan 26, 2024
1 parent 0696680 commit cfb8374
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Version bump
# only if manual workflow dispatch and not on a tag
if: github.event_name == 'workflow_dispatch' && !startsWith(github.ref, 'refs/tags/')
run: npm version prepatch --preid=$(git rev-parse --short HEAD) --no-git-tag-version

- name: Publish
shell: bash
run: pnpm publish --access public --no-git-checks
run: |
# manual workflow dispatches are tagged as pre-release - all releases should go through proper tagging process
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
FLAGS="--tag pre"
fi
pnpm publish --access public --no-git-checks $FLAGS
env:
NODE_AUTH_TOKEN: ${{ matrix.registry.token }}

0 comments on commit cfb8374

Please sign in to comment.