name: Release on: push: tags: - 'v*.*.*' permissions: contents: read id-token: write jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 registry-url: 'https://registry.npmjs.org' cache: npm - run: rm -f package-lock.json && npm install - 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 "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)" exit 1 fi - run: npm run lint - run: npm test - run: npm publish --access public --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}