Skip to content

Publish to npm (OIDC) #2

Publish to npm (OIDC)

Publish to npm (OIDC) #2

Workflow file for this run

name: Publish to npm (OIDC)
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 3.7.1). Leave blank to use package.json.'
required: false
type: string
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Upgrade npm (OIDC trusted publisher requires npm 11.5.1+)
run: npm install -g npm@latest
- run: npm ci
- run: npm run build
- run: npm test
- name: Update version (if specified)
if: ${{ github.event.inputs.version }}
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
- run: npm publish --provenance --access public