Skip to content

Commit e34a3a8

Browse files
PaulDuvallclaude
andcommitted
fix: improve NPM authentication and error handling in publish workflow
- Use npm config set instead of echo to .npmrc for better compatibility - Add NODE_AUTH_TOKEN environment variable for redundancy - Enhanced error messages with common failure causes - Added package name verification before publish - Better error handling with detailed diagnostics This should resolve authentication issues with fine-grained NPM tokens 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 56ef4c0 commit e34a3a8

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/npm-publish-simple.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,32 @@ jobs:
4747
4848
- name: Configure NPM
4949
run: |
50-
echo "//registry.npmjs.org/:_authToken=${{ inputs.npm_token }}" >> ~/.npmrc
50+
npm config set //registry.npmjs.org/:_authToken=${{ inputs.npm_token }}
5151
echo "::add-mask::${{ inputs.npm_token }}"
5252
5353
- name: Verify NPM Authentication
5454
run: |
5555
echo "Verifying NPM authentication..."
56-
npm whoami || echo "⚠️ Not authenticated - token may be invalid"
56+
npm whoami 2>/dev/null || echo "⚠️ Warning: Could not verify authentication"
57+
echo "Registry config:"
58+
npm config get registry
5759
5860
- name: Publish
61+
env:
62+
NODE_AUTH_TOKEN: ${{ inputs.npm_token }}
5963
run: |
6064
cd claude-dev-toolkit
6165
echo "Publishing @paulduvall/claude-dev-toolkit..."
62-
npm publish --access public --verbose
66+
echo "Current directory: $(pwd)"
67+
echo "Package name from package.json:"
68+
grep '"name"' package.json
69+
npm publish --access public --verbose 2>&1 || {
70+
echo "❌ Publish failed. Common causes:"
71+
echo " 1. Token doesn't have publish permissions"
72+
echo " 2. Package name already exists (try bumping version)"
73+
echo " 3. Network/registry issues"
74+
exit 1
75+
}
6376
6477
- name: Verify SSM parameter (Optional)
6578
continue-on-error: true

0 commit comments

Comments
 (0)