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
68 changes: 68 additions & 0 deletions .github/workflows/publish-package-to-npmjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish package to npmjs.com

on:
workflow_dispatch:
release:
types: [published]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and test package
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22.x'
cache: 'npm'
Comment on lines +23 to +27
- run: npm ci
- run: npm run typecheck
- run: npm run format:check
- run: npm run lint
- run: npm test

publish-to-npm:
name: Publish npm package to npmjs.com
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'

# Trusted publishing requires npm 11.5.1 or later
# https://docs.npmjs.com/trusted-publishers
- name: Update npm
run: npm install -g npm@latest

Comment on lines +48 to +52
- name: Show npm version
run: npm -v

- name: Install dependencies
run: npm ci

- name: Build package for release
run: npm run build

- name: Publish to npmjs.com
run: >-
npm
--loglevel notice
publish
--provenance
--access public