-
Notifications
You must be signed in to change notification settings - Fork 0
Publishing to NPM
Vadim edited this page Feb 12, 2026
·
6 revisions
Projects using this template often rely on GitHub Releases as the primary release source.
However, automated publishing to the NPM Registry can be integrated using the npm-publish GitHub Action.
A minimal workflow that publishes when a GitHub Release becomes public:
name: Publish to NPM
on:
release:
types: [published]
jobs:
npm-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: "24"
- run: npm ci
- run: npm test
- run: npm publish --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}name: Publish to GitHub Packages
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
+ packages: write
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: "24"
- run: npm ci
- run: npm test
- run: npm publish --no-git-checks
env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}