Skip to content

Publish to npm

Publish to npm #2

Workflow file for this run

name: Publish to npm
on:
release:
types: [created]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 10
strategy:
matrix:
node-version: [22, 20, 18, 16]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
publish:
needs: test
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}