Skip to content

npm publish

npm publish #8

Workflow file for this run

name: npm publish
on:
push:
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
name: CI (Node ${{ matrix.node-version }})
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
node-version:
- 20
- 22
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run checks
run: npm run check
publish:
name: Publish to npm
runs-on: windows-latest
needs:
- ci
- pre_publish_check
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Publish package
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
pre_publish_check:
name: Pre-Publish Gate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: ./.github/workflows/pre-publish-check.yml
with:
tag_name: ${{ github.ref_name }}