Skip to content

v0.2.0

v0.2.0 #4

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Verify tag matches package.json version
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION="$(node -p "require('./package.json').version")"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Release tag v$TAG_VERSION does not match package.json version $PKG_VERSION"
exit 1
fi
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
- name: Publish (beta)
if: github.event.release.prerelease == true
run: npm publish --tag beta --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish (stable)
if: github.event.release.prerelease == false
run: npm publish --tag latest --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}