Skip to content

Commit e3e313d

Browse files
committed
Migrate npm publishing workflow to trusted publishing via OIDC
The npm package configuration is already prepared for trusted publishing, so the release workflow should stop relying on long- lived NPM tokens. This updates the GitHub Actions release job to use OIDC permissions with direct `npm publish`, removes temporary `.npmrc` token setup, and refreshes checkout/setup-node actions while keeping the tag-driven release flow intact. Constraint: npm trusted publishing validates the exact GitHub workflow filename and requires `id-token: write` Constraint: Trusted publishing requires npm CLI support and a sufficiently new Node runtime in CI Rejected: Keep token-based publish as fallback in the same workflow | defeats the security goal and complicates release diagnostics Confidence: high Scope-risk: narrow Directive: Keep publish authentication tokenless in CI; if future installs need auth, use separate read-only credentials only for install steps Tested: Release workflow file reviewed against npm trusted publisher requirements; local package/docs verification already green on the tagged candidate Not-tested: GitHub Actions trusted publish end-to-end until the updated tag is pushed and the workflow runs
1 parent 4e57997 commit e3e313d

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
contents: write
1313
id-token: write
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Setup Node.js
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v6
2121
with:
22-
node-version: '22'
22+
node-version: '24'
2323
registry-url: 'https://registry.npmjs.org'
2424

2525
- name: Setup pnpm
@@ -36,13 +36,9 @@ jobs:
3636
- name: Build package
3737
run: pnpm build
3838

39-
- name: Create .npmrc
40-
run: |
41-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
42-
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
43-
4439
- name: Publish to NPM
45-
run: pnpm --filter=stax-xml publish --access public --no-git-checks
40+
working-directory: packages/stax-xml
41+
run: npm publish --access public
4642

4743
- name: Generate changelog
4844
run: pnpm dlx changelogithub

0 commit comments

Comments
 (0)