Skip to content

Publish to npm

Publish to npm #3

Workflow file for this run

# Publish package to npm
name: Publish to npm
on:
release:
types: [published]
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (do not actually publish)'
type: boolean
default: true
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build library
run: npm run build:lib
- name: Publish (dry run)
if: ${{ github.event.inputs.dry_run == 'true' }}
run: npm publish --dry-run
- name: Publish to npm
if: ${{ github.event_name == 'release' || github.event.inputs.dry_run == 'false' }}
run: npm publish