Skip to content

Commit 1d13837

Browse files
authored
Merge pull request #52 from chaitin/develop/jw
ci(workflow): 更新 npm 发布工作流以支持 GitHub Packages 和 NPM 注册表
2 parents 562e77d + 7cbe6c8 commit 1d13837

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/npm_publish.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: read
10+
packages: write
1011

1112
jobs:
1213
publish:
@@ -19,7 +20,8 @@ jobs:
1920
uses: actions/setup-node@v4
2021
with:
2122
node-version: '18'
22-
registry-url: 'https://registry.npmjs.org'
23+
registry-url: 'https://npm.pkg.github.com'
24+
scope: '@yokowu'
2325

2426
- name: Setup pnpm
2527
uses: pnpm/action-setup@v4
@@ -40,8 +42,17 @@ jobs:
4042
TAG_VERSION=${GITHUB_REF#refs/tags/v}
4143
npm version $TAG_VERSION --no-git-tag-version
4244
43-
- name: Publish to NPM Registry
45+
- name: Publish to GitHub Packages
4446
working-directory: ./ui/ModelModal
4547
run: pnpm publish --no-git-checks
4648
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Publish to NPM Registry
52+
working-directory: ./ui/ModelModal
53+
run: |
54+
npm config set registry https://registry.npmjs.org/
55+
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
56+
pnpm publish --no-git-checks
57+
env:
58+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)