Skip to content

Commit 0f3aa65

Browse files
committed
fix(ci): force npm userconfig + whoami gate for publish auth
1 parent 69db733 commit 0f3aa65

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
with:
2222
node-version: '18.x'
2323
scope: '@foo-software'
24+
registry-url: 'https://registry.npmjs.org'
25+
always-auth: true
2426
- name: Full Clean (no npm cache)
2527
run: |
2628
rm -rf node_modules
@@ -37,7 +39,12 @@ jobs:
3739
npm ls @jest/types || true
3840
3941
- name: Publish Packages
42+
env:
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4044
run: |
41-
echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ${{ github.workspace }}/.npmrc
45+
# Force npm to use an explicit userconfig (matches the local workaround that actually publishes)
46+
printf "//registry.npmjs.org/:_authToken=%s\n" "$NPM_TOKEN" > "${GITHUB_WORKSPACE}/.npmrc"
47+
export NPM_CONFIG_USERCONFIG="${GITHUB_WORKSPACE}/.npmrc"
48+
npm whoami
4249
node packages/foo-api-ci-tools/dist/bin/config-git.js
4350
node packages/foo-api-ci-tools/dist/bin/publish-packages.js

0 commit comments

Comments
 (0)