Skip to content

Commit 2254d8e

Browse files
committed
Configure workflow for npm Trusted Publishers per official docs
1 parent bede62f commit 2254d8e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
release:
1717
name: Release
1818
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
id-token: write # Required for OIDC authentication to npm
1923
steps:
2024
- name: Checkout repository
2125
uses: actions/checkout@v4
@@ -29,10 +33,13 @@ jobs:
2933
- name: Setup Node.js
3034
uses: actions/setup-node@v4
3135
with:
32-
node-version: '18'
36+
node-version: '20'
3337
cache: 'pnpm'
3438
registry-url: 'https://registry.npmjs.org'
3539

40+
- name: Upgrade npm to v11.5.1+ for Trusted Publishers
41+
run: npm install -g npm@latest
42+
3643
- name: Install dependencies
3744
run: pnpm install --frozen-lockfile
3845

@@ -42,18 +49,15 @@ jobs:
4249
- name: Run tests
4350
run: pnpm test
4451

45-
- name: Remove .npmrc for OIDC authentication
46-
run: rm -f ~/.npmrc
47-
4852
- name: Create Release Pull Request or Publish to npm
4953
id: changesets
5054
uses: changesets/action@v1
5155
with:
5256
# Creates a "Version Packages" PR when changesets are added
5357
version: pnpm changeset version
5458
# Publishes packages when version PR is merged
55-
# Using --provenance for npm Trusted Publishers
56-
publish: pnpm changeset publish --provenance
59+
# Provenance is automatic with OIDC - no --provenance flag needed
60+
publish: pnpm changeset publish
5761
# Commit message for version PR
5862
commit: 'chore: version packages'
5963
# Title for version PR

0 commit comments

Comments
 (0)