Skip to content

v1.2.0

v1.2.0 #11

Workflow file for this run

name: Publish to NPM
on:
release:
types: [published]
jobs:
publish-npm:
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/
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build package
run: npm run build
- name: Check package version matches release
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
GITHUB_REF_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$PKG_VERSION" != "$GITHUB_REF_VERSION" ]; then
echo "::error::Package version ($PKG_VERSION) does not match release tag ($GITHUB_REF_VERSION)"
exit 1
fi
- name: Publish to NPM
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}