Skip to content

ci: use explicit node test file #2

ci: use explicit node test file

ci: use explicit node test file #2

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- "v*"
permissions:
contents: read
id-token: write
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
registry-url: https://registry.npmjs.org
- name: Verify tag matches package.json version
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "${TAG_VERSION}" != "${PKG_VERSION}" ]; then
echo "Tag v${TAG_VERSION} does not match package.json version ${PKG_VERSION}"
exit 1
fi
- name: Install dependencies
run: npm ci
- name: Release gate
run: npm run test:release
- name: Publish dry run
run: npm publish --dry-run --access public
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}