Skip to content

4.0.0-beta.4

4.0.0-beta.4 #4

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm install -g npm@latest
- run: npm install
- run: npm test
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm@latest
- run: npm install
- name: Set package version from release tag
run: npm version "${{ github.event.release.tag_name }}" --no-git-tag-version --allow-same-version
- name: Publish to npm
run: |
VERSION="${{ github.event.release.tag_name }}"
if [[ "$VERSION" == *-* ]]; then
# prerelease (e.g. 4.0.0-beta.1, 4.0.0-rc.2) — derive dist-tag from label
TAG=$(echo "$VERSION" | sed -E 's/^[^-]+-([a-zA-Z]+).*/\1/')
npm publish --provenance --access public --tag "$TAG"
else
npm publish --provenance --access public
fi