Skip to content

publish to npmjs

publish to npmjs #13

Workflow file for this run

name: Publish Package to npmjs
on:
workflow_dispatch:
release:
types: [published]
push:
branches:
- main
# cancel previous runs if a new one is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm publish --provenance --access public
# only if the commit message contains chore(release), or if manually triggered with workflow_dispatch
if: contains(github.event.head_commit.message, 'chore(release)') || github.event_name == 'workflow_dispatch'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}