Skip to content

Commit 9524434

Browse files
committed
ci: 将npm发布从GitHub Packages迁移到NPM Registry
更新package.json和CI配置,将包发布目标从GitHub Packages改为NPM Registry 移除不再需要的packages: write权限和冗余的npm配置步骤
1 parent 7cbe6c8 commit 9524434

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

.github/workflows/npm_publish.yml

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

88
permissions:
99
contents: read
10-
packages: write
1110

1211
jobs:
1312
publish:
@@ -20,8 +19,7 @@ jobs:
2019
uses: actions/setup-node@v4
2120
with:
2221
node-version: '18'
23-
registry-url: 'https://npm.pkg.github.com'
24-
scope: '@yokowu'
22+
registry-url: 'https://registry.npmjs.org'
2523

2624
- name: Setup pnpm
2725
uses: pnpm/action-setup@v4
@@ -42,17 +40,8 @@ jobs:
4240
TAG_VERSION=${GITHUB_REF#refs/tags/v}
4341
npm version $TAG_VERSION --no-git-tag-version
4442
45-
- name: Publish to GitHub Packages
46-
working-directory: ./ui/ModelModal
47-
run: pnpm publish --no-git-checks
48-
env:
49-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
5143
- name: Publish to NPM Registry
5244
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
45+
run: pnpm publish --no-git-checks
5746
env:
58-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

ui/ModelModal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"./styles": "./dist/styles.css"
1717
},
1818
"publishConfig": {
19-
"registry": "https://npm.pkg.github.com"
19+
"registry": "https://registry.npmjs.org"
2020
},
2121
"files": [
2222
"dist"

0 commit comments

Comments
 (0)