-
Notifications
You must be signed in to change notification settings - Fork 0
Publishing packages
Vadim edited this page Aug 7, 2026
·
3 revisions
Projects using this template use GitHub Releases as the source of truth for releases. Package publishing can be added as a separate workflow triggered when a Release becomes public.
name: Publish package
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "24"
- run: npm ci
- run: npm test
- run: npm publish --ignore-scriptsReplace the setup and publish steps. pnpm install runs automatically when a package.json is present.
- - uses: actions/setup-node@v7
- with:
- node-version: "24"
+ - uses: pnpm/setup@v2
+ with:
+ cache: true
- - run: npm ci
- - run: npm test
+ - run: pnpm test
- - run: npm publish --ignore-scripts
+ - run: pnpm publish --no-git-checksUpdate the workflow as follows:
permissions:
contents: read
- id-token: write
+ packages: write
...
- run: npm publish --ignore-scripts
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}With pnpm v11+, configure GitHub Packages authentication before publishing:
+ - run: pnpm config set //npm.pkg.github.com/:_authToken "${{ secrets.GITHUB_TOKEN }}"
- run: pnpm publish --no-git-checksProvenance statements provide verifiable information about how a package was built.
For more information, see the official npm documentation…
Warning
Provenance generation requires the package to be public.
- run: npm publish --ignore-scripts
+ env:
+ NPM_CONFIG_PROVENANCE: true - run: pnpm publish --no-git-checks
+ env:
+ NPM_CONFIG_PROVENANCE: true