Skip to content

Publish to NPM

Publish to NPM #22

Workflow file for this run

---
name: Publish to NPM
on:
workflow_run:
workflows: [Set Package Version]
types:
- completed
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Ensure branch is main
run: |
git fetch origin main
git checkout main
git pull origin main
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Determine Branch
run:
echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Publish to NPM with provenance
run: pnpm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}