Skip to content

Commit 898f957

Browse files
committed
fix: CI npm auth 使用项目级 .npmrc
1 parent 1f5a8a2 commit 898f957

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
release:
55
types: [published]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
publish:
912
runs-on: ubuntu-latest
@@ -20,8 +23,15 @@ jobs:
2023
- name: Build
2124
run: bun run build
2225

23-
- name: Create .npmrc
24-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
26+
- name: Setup npm auth
27+
run: |
28+
cat > .npmrc << EOF
29+
//registry.npmjs.org/:_authToken=\${NPM_TOKEN}
30+
EOF
31+
env:
32+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2533

2634
- name: Publish to npm
27-
run: npm publish
35+
run: npm publish --access public
36+
env:
37+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)