Skip to content

Commit d5c9a2a

Browse files
committed
fix(ci): configure pnpm npm registry auth before publish
pnpm 11's native publish no longer inherits auth from the NPM_TOKEN env var the way pnpm 10's npm-CLI-shelling publish did, and pnpm 10.34.2+/11.5.3+ also stopped expanding ${VAR} placeholders from a repo's .npmrc (GHSA-3qhv-2rgh-x77r). Explicitly run `pnpm config set` before the changesets/action publish step, matching the pattern already used in .github/actions/changeset-snapshot/action.yml.
1 parent d8fa2e1 commit d5c9a2a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ jobs:
5050
- name: Setup node and install deps
5151
uses: ./.github/actions/node-setup
5252

53+
# pnpm 11 stopped expanding ${NPM_TOKEN}-style placeholders from a repo's
54+
# .npmrc (GHSA-3qhv-2rgh-x77r), so auth has to be written via `pnpm config
55+
# set` at runtime instead of relying on env-var substitution in .npmrc.
56+
- name: Configure npm registry auth
57+
shell: bash
58+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
59+
env:
60+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
61+
5362
# Process changesets: create version PR or publish packages to npm
5463
# This step requires write permissions to create releases and publish packages
5564
- name: Create Release Pull Request or Publish to npm

.github/workflows/next.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ jobs:
7272
- name: Setup node and install deps
7373
uses: ./.github/actions/node-setup
7474

75+
# pnpm 11 stopped expanding ${NPM_TOKEN}-style placeholders from a repo's
76+
# .npmrc (GHSA-3qhv-2rgh-x77r), so auth has to be written via `pnpm config
77+
# set` at runtime instead of relying on env-var substitution in .npmrc.
78+
- name: Configure npm registry auth
79+
shell: bash
80+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
81+
env:
82+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
83+
7584
- name: Create Release Pull Request or Publish to npm
7685
id: changesets
7786
uses: changesets/action@v2

0 commit comments

Comments
 (0)