Skip to content

Commit 562e77d

Browse files
authored
Merge pull request #51 from chaitin/develop/jw
ci(workflows): 添加 npm 发布工作流配置
2 parents 8c85414 + 882db5a commit 562e77d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/npm_publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish NPM Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 8
28+
29+
- name: Install dependencies
30+
working-directory: ./ui/ModelModal
31+
run: pnpm install
32+
33+
- name: Build package
34+
working-directory: ./ui/ModelModal
35+
run: pnpm build
36+
37+
- name: Update package version from tag
38+
working-directory: ./ui/ModelModal
39+
run: |
40+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
41+
npm version $TAG_VERSION --no-git-tag-version
42+
43+
- name: Publish to NPM Registry
44+
working-directory: ./ui/ModelModal
45+
run: pnpm publish --no-git-checks
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)