Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish package

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: read
id-token: write

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- name: Checkout release tag
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: https://registry.npmjs.org

- name: Install npm with trusted publishing support
run: npm install --global npm@11.5.1

- name: Validate release version
shell: bash
run: |
package_version="$(node -p "require('./package.json').version")"
tag_version="${GITHUB_REF_NAME#v}"
if [[ "$package_version" != "$tag_version" ]]; then
echo "Package version $package_version does not match tag version $tag_version."
exit 1
fi

- name: Install dependencies
run: npm ci

- name: Publish package
run: npm publish --provenance
Loading