File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish Package
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *.*.*'
7+
8+ # OIDC Trusted Publishing 需要以下权限
9+ # - id-token: write - 允许 GitHub Actions 生成 OIDC token
10+ # - contents: read - 允许读取仓库内容
11+ permissions :
12+ id-token : write
13+ contents : read
14+
15+ jobs :
16+ publish :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Setup pnpm
24+ uses : pnpm/action-setup@v4
25+ with :
26+ version : 9
27+
28+ - name : Setup Node.js
29+ uses : actions/setup-node@v4
30+ with :
31+ node-version : ' 20'
32+ registry-url : ' https://registry.npmjs.org'
33+
34+ # 确保使用最新版本的 npm 以支持 Trusted Publishing
35+ - name : Update npm
36+ run : npm install -g npm@latest
37+
38+ - name : Install dependencies
39+ run : pnpm install
40+
41+ - name : Run build
42+ run : pnpm build
43+
44+ - name : Run tests
45+ run : pnpm test
46+
47+ # 使用 OIDC Trusted Publishing 发布,无需 token
48+ # 在 npmjs.com 上配置 Trusted Publisher 后,npm 会自动使用 OIDC 认证
49+ - name : Publish to npm
50+ run : npm publish --access public
Original file line number Diff line number Diff line change 3939 "typescript" : " ^5.0.0" ,
4040 "vitest" : " ^3.2.6"
4141 },
42- "repository" : " git@github.com:antvis/context.git"
42+ "repository" : " git@github.com:antvis/context.git" ,
43+ "publishConfig" : {
44+ "access" : " public" ,
45+ "registry" : " https://registry.npmjs.org"
46+ }
4347}
You can’t perform that action at this time.
0 commit comments