Skip to content

Commit c2994c6

Browse files
committed
ci(workflow): refine npm publish workflow with OIDC diagnostics
- Add `packages: write` permission for npm OIDC authentication. - Split steps into clearly named tasks: install, build, verify OIDC, and publish. - Introduce an optional `whoami` diagnostic step to verify OIDC setup without failing the job.
1 parent d535be0 commit c2994c6

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
permissions:
88
id-token: write
99
contents: read
10+
packages: write
1011

1112
jobs:
1213
publish:
@@ -26,5 +27,17 @@ jobs:
2627
registry-url: https://registry.npmjs.org
2728
cache: 'pnpm'
2829

29-
- run: pnpm install
30-
- run: pnpm run build && pnpm publish --provenance --access public --no-git-checks
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Build
34+
run: pnpm run build
35+
36+
- name: Verify OIDC authentication (diagnostic)
37+
# If OIDC trust is configured on npm this should print the npm username.
38+
# Keep permissive so it won't fail the job if whoami doesn't return.
39+
run: |
40+
npm whoami || pnpm whoami || true
41+
42+
- name: Publish to npm (via OIDC)
43+
run: pnpm publish --provenance --access public --no-git-checks

0 commit comments

Comments
 (0)