Skip to content

Commit 7d1e362

Browse files
committed
fix(workflow): update npm publish workflow to support OIDC and npm CLI version
1 parent fc3638a commit 7d1e362

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
contents: write
1212
issues: write
1313
pull-requests: write
14+
id-token: write
1415
steps:
1516
- uses: actions/checkout@v4
1617
with:
@@ -24,17 +25,17 @@ jobs:
2425
registry-url: https://registry.npmjs.org/
2526
scope: "@smakss"
2627
cache: pnpm
28+
- name: Ensure npm CLI supports OIDC
29+
run: npm install -g npm@11.5.1
2730
- run: pnpm install --frozen-lockfile
2831
- run: pnpm build
2932
- name: Release (master)
3033
if: github.ref_name == 'master'
3134
run: pnpm release
3235
env:
3336
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3537
- name: Release (develop)
3638
if: github.ref_name == 'develop'
3739
run: pnpm release
3840
env:
3941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ Releases are automated with semantic-release on every push to the `master` and
4747
- Do not manually bump versions or edit a changelog; releases are published on
4848
GitHub without committing files back to the repo.
4949
- Follow Conventional Commits so the release type can be inferred.
50-
- The GitHub Actions workflow requires these secrets:
51-
- `NPM_TOKEN` (publish to npm)
52-
- `GITHUB_TOKEN` (create GitHub release)
50+
- Releases use npm trusted publishing (OIDC). Configure the repository as a
51+
trusted publisher in npm (using this workflow file) and ensure the workflow
52+
has `id-token: write` and npm CLI >= 11.5.1.
53+
- `GITHUB_TOKEN` is used to create GitHub releases.
5354

5455
To run a local dry run:
5556

0 commit comments

Comments
 (0)