Skip to content

Commit d2ad403

Browse files
author
strausr
committed
fix: configure npm authentication for trusted publishing with semantic-release
1 parent 92475e1 commit d2ad403

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
with:
6363
node-version: '20'
6464
registry-url: 'https://registry.npmjs.org'
65+
always-auth: true
6566

6667
- run: npm ci
6768

@@ -96,6 +97,25 @@ jobs:
9697
echo "=== Git tags ==="
9798
git tag
9899
100+
- name: Debug npm auth
101+
run: |
102+
echo "=== NPM Config ==="
103+
cat ~/.npmrc 2>/dev/null || echo "No ~/.npmrc found"
104+
echo ""
105+
echo "=== NPM Token from env ==="
106+
echo "NODE_AUTH_TOKEN is set: $([ -n "$NODE_AUTH_TOKEN" ] && echo 'yes' || echo 'no')"
107+
echo ""
108+
echo "=== NPM whoami ==="
109+
npm whoami --registry=https://registry.npmjs.org || echo "npm whoami failed"
110+
echo ""
111+
echo "=== Setting NPM_TOKEN from NODE_AUTH_TOKEN for semantic-release ==="
112+
if [ -n "$NODE_AUTH_TOKEN" ]; then
113+
echo "NPM_TOKEN=$NODE_AUTH_TOKEN" >> $GITHUB_ENV
114+
echo "NPM_TOKEN set from NODE_AUTH_TOKEN"
115+
else
116+
echo "Warning: NODE_AUTH_TOKEN not found"
117+
fi
118+
99119
- name: Release
100120
env:
101121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
[
1414
"@semantic-release/npm",
1515
{
16-
"npmPublish": true
16+
"npmPublish": true,
17+
"tarballDir": false
1718
}
1819
],
1920
[

0 commit comments

Comments
 (0)