Skip to content

Commit a466b24

Browse files
fix: write GitHub Packages auth to NPM_CONFIG_USERCONFIG not ~/.npmrc (#37)
actions/setup-node sets NPM_CONFIG_USERCONFIG to a temp file; appending the @raphaelmansuy scope and GitHub Packages token to ~/.npmrc was being ignored, causing ENEEDAUTH on every GitHub Packages publish step.
1 parent 0cba356 commit a466b24

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/release-wasm.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ jobs:
178178
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
179179
"
180180
# Write a scoped .npmrc so npm uses the right registry for this scope.
181-
echo "@raphaelmansuy:registry=https://npm.pkg.github.com" >> ~/.npmrc
182-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
181+
# actions/setup-node sets NPM_CONFIG_USERCONFIG to a temp file; append there,
182+
# not to ~/.npmrc, so npm actually picks up the GitHub Packages token.
183+
NPMRC="${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}"
184+
echo "@raphaelmansuy:registry=https://npm.pkg.github.com" >> "$NPMRC"
185+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> "$NPMRC"
183186
cd crates/edgeparse-wasm/pkg
184187
npm publish --registry https://npm.pkg.github.com \
185188
|| { CODE=$?; echo "GitHub Packages publish exited $CODE — may already exist for this version." ; }

0 commit comments

Comments
 (0)