File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -144,13 +144,23 @@ jobs:
144144 fi
145145 fi
146146
147- if [ -n "$NPM_TOKEN" ] && [ "$NPM_TOKEN" != "\${NODE_AUTH_TOKEN}" ]; then
147+ # Clean up the token (remove any whitespace, newlines, etc.)
148+ NPM_TOKEN=$(echo "$NPM_TOKEN" | tr -d '\n\r\t ' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
149+
150+ if [ -n "$NPM_TOKEN" ] && [ "$NPM_TOKEN" != "\${NODE_AUTH_TOKEN}" ] && [ ${#NPM_TOKEN} -gt 10 ]; then
148151 echo "::add-mask::$NPM_TOKEN"
149152 echo "NPM_TOKEN=$NPM_TOKEN" >> $GITHUB_ENV
150153 echo "✓ NPM_TOKEN extracted and set (length: ${#NPM_TOKEN} chars)"
154+
155+ # Also ensure .npmrc is properly formatted for npm
156+ echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
157+ echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
158+ echo "always-auth=true" >> ~/.npmrc
159+ echo "✓ Recreated .npmrc with proper format"
151160 else
152161 echo "✗ Error: Could not extract valid token from .npmrc"
153- echo "Token value: '$NPM_TOKEN'"
162+ echo "Token length: ${#NPM_TOKEN} chars"
163+ echo "Token preview (first 10 chars): ${NPM_TOKEN:0:10}..."
154164 echo ""
155165 echo "Full .npmrc content (first 10 lines, tokens masked):"
156166 head -10 ~/.npmrc | sed 's/=.*/=***/' || true
Original file line number Diff line number Diff line change 1414 " @semantic-release/npm" ,
1515 {
1616 "npmPublish" : true ,
17- "registry" : " https://registry.npmjs.org/"
17+ "registry" : " https://registry.npmjs.org/" ,
18+ "pkgRoot" : " ."
1819 }
1920 ],
2021 [
You can’t perform that action at this time.
0 commit comments