Skip to content

1.8.5

1.8.5 #9

Workflow file for this run

name: Publish to npm (tag v*)
on:
push:
tags:
- 'v*'
workflow_dispatch: {}
permissions:
contents: read
id-token: write # for npm --provenance
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
always-auth: true
- name: Install
run: npm ci
- name: Build
run: npm run build --if-present
- name: Test
run: npm test --if-present
- name: Verify tag matches package.json
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(node -p "require('./package.json').version")
[[ "$TAG" == "$PKG_VERSION" ]] || { echo "Tag v$TAG != package.json $PKG_VERSION"; exit 1; }
- name: Configure npm auth
run: |
echo "registry=https://registry.npmjs.org" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: npm publish --provenance --access public