Skip to content

Commit dff8a77

Browse files
author
Ibrahim
committed
Fix: Pass NPM_TOKEN to setup-node action for authentication
1 parent e0e0956 commit dff8a77

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
with:
3131
node-version: '20'
3232
registry-url: 'https://registry.npmjs.org'
33-
# If NPM_TOKEN is set, it will be used; otherwise OIDC will be attempted
33+
# Pass NPM_TOKEN if available, otherwise OIDC will be attempted
34+
# For new packages, NPM_TOKEN is required for first publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3437

3538
- name: Extract version from tag
3639
id: version
@@ -71,16 +74,14 @@ jobs:
7174
- name: Publish to npm
7275
run: |
7376
cd packages/wex-threejs
74-
# For brand new packages, npm Trusted Publishing (OIDC) may not work
75-
# If this step fails, create an NPM_TOKEN secret in GitHub:
77+
# NPM_TOKEN secret is required for first-time publishing
78+
# If this step fails with "404 Not Found" or "Access token expired":
7679
# 1. Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
7780
# 2. Generate a new "Automation" token with "Publish" permission
7881
# 3. Add it as a secret: GitHub repo > Settings > Secrets > Actions > New secret
7982
# Name: NPM_TOKEN, Value: your token
80-
# After first publish, you can remove NPM_TOKEN and use OIDC only
83+
# After first publish, you can optionally remove NPM_TOKEN and use OIDC only
8184
npm publish --access public --provenance
82-
env:
83-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8485
8586
- name: Create GitHub Release
8687
uses: softprops/action-gh-release@v1

0 commit comments

Comments
 (0)