Skip to content

Commit 0ada0b0

Browse files
metowolfclaude
andcommitted
fix: 修改 GitHub Actions 使用 .npmrc 文件进行 npm 认证
- 移除 registry-url 配置,改为直接创建 .npmrc 文件 - 在 CI 中动态创建包含 NPM_TOKEN 的 .npmrc 文件 - 简化发布流程,避免环境变量可能导致的认证问题 - 解决 npm publish 404 Not Found 错误 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ffb2f39 commit 0ada0b0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: '20.x'
23-
registry-url: 'https://registry.npmjs.org'
2423

2524
- name: Install dependencies
2625
run: npm ci
2726

2827
- name: Build project
2928
run: npm run build
3029

30+
- name: Create .npmrc file
31+
run: |
32+
echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" > .npmrc
33+
echo "registry=https://registry.npmjs.org/" >> .npmrc
34+
3135
- name: Publish to npm
32-
run: npm publish --access public
33-
env:
34-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
run: npm publish --access public

0 commit comments

Comments
 (0)