Skip to content

ci: add GitHub Actions for tests and tagged releases #1

ci: add GitHub Actions for tests and tagged releases

ci: add GitHub Actions for tests and tagged releases #1

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Install latest npm (required for OIDC)
run: npm install -g npm@latest
- name: Verify tag matches package version
run: |
TAG="${GITHUB_REF#refs/tags/v}"
PKG=$(node -p "require('./package.json').version")
if [ "$TAG" != "$PKG" ]; then
echo "Tag v$TAG does not match package.json version $PKG"
exit 1
fi
- name: Run tests
run: node --test authforge.test.mjs
- name: Publish to npm
run: npm publish --provenance --access public