ci(publish): fall back to NODE_AUTH_TOKEN when NPM_TOKEN secret blank

Belt and suspenders — accept either secret name, error out at config
time with a clear message if both are blank. Lets the run fail fast
in the auth step instead of opaquely in pnpm publish.
This commit is contained in:
2026-05-21 16:59:33 -07:00
parent 5be700e62c
commit a88fc508ea
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -49,15 +49,21 @@ jobs:
# has to be on disk. setup-node@v4 sets NPM_CONFIG_USERCONFIG to
# a temp path; we write to that exact path so pnpm picks it up.
run: |
token="${NPM_TOKEN:-$NODE_AUTH_TOKEN}"
if [ -z "$token" ]; then
echo "::error::No NPM token available (NPM_TOKEN nor NODE_AUTH_TOKEN set)"
exit 1
fi
target="${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}"
cat > "$target" <<NPMRC
registry=https://registry.npmjs.org/
@luxfi:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
//registry.npmjs.org/:_authToken=${token}
always-auth=true
NPMRC
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm install --frozen-lockfile || pnpm install
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "1.1.6",
"version": "1.1.7",
"private": true,
"description": "Lux Bridge - Decentralized cross-chain bridge using MPC",
"packageManager": "[email protected]",