Skip to content

Publish to NPM

Publish to NPM #25

name: Publish to NPM
on:
workflow_dispatch:
inputs:
ref:
description: Git ref to publish (branch, tag, or commit SHA)
required: true
type: string
tag:
description: NPM dist-tag
required: true
type: choice
default: latest
options:
- latest
- beta
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
publish_to_npm:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}
- name: Use Node.js 22
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: |
npm ci
- name: Check version consistency and bump pre-release version (beta only)
if: ${{ inputs.tag == 'beta' }}
run: node ./.github/scripts/before-beta-release.js
- name: Build module
run: npm run build
- name: Publish to NPM
run: npm publish --tag ${{ inputs.tag }}