Skip to content

Release

Release #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: npm
registry-url: "https://registry.npmjs.org"
- name: Ensure manual releases run from main or master
if: github.event_name == 'workflow_dispatch'
run: |
if [ "${GITHUB_REF_NAME}" != "main" ] && [ "${GITHUB_REF_NAME}" != "master" ]; then
echo "Manual release must run from main or master."
exit 1
fi
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/')
run: |
node -e "const pkg=require('./package.json'); const tag=process.env.GITHUB_REF_NAME; if (tag !== `v${pkg.version}`) { throw new Error(`Tag ${tag} does not match package.json version v${pkg.version}`); }"
- name: Install dependencies
run: npm ci
- name: Run quality checks
run: npm run check
- name: Run package smoke test
run: npm run test:package
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}