Skip to content

Commit 1c93c46

Browse files
committed
chore(Github): 格式化工作流配置文件, 按照步骤拆分统一格式
1 parent 59c078c commit 1c93c46

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,38 @@ jobs:
99
publish-npm:
1010
runs-on: ubuntu-latest
1111
steps:
12+
# checkout 代码
1213
- uses: actions/checkout@v4
1314
with:
1415
fetch-depth: 0 # 获取完整历史
1516
clean: true # 清理工作目录
16-
- uses: actions/setup-node@v1
17+
# 准备 node
18+
- uses: actions/setup-node@v4
1719
with:
1820
node-version: 18
1921
registry-url: https://registry.npmjs.org/
20-
- run: git config --global user.email ${{secrets.USER_EMAIL}}
21-
- run: git config --global user.name ${{secrets.USER_NAME}}
22-
- run: npm install pnpm -g
23-
- run: pnpm install
24-
- run: pnpm build
22+
# 准备 pnpm
23+
- uses: pnpm/action-setup@v4
24+
with:
25+
version: 8
26+
cache: pnpm
27+
# 配置 git 用户
28+
- name: Setup git user
29+
run: |
30+
git config --global user.email ${{secrets.USER_EMAIL}}
31+
git config --global user.name ${{secrets.USER_NAME}}
32+
# 安装依赖
33+
- name: Install dependencies
34+
run: pnpm install
35+
# 构建产物
36+
- name: Build
37+
run: pnpm build
38+
# 强制同步远程 git 标签(消除远程已删除的 tag 缓存对 Lerna 计算 commit 的影响)
2539
- name: Sync git tags
2640
run: |
2741
git fetch --prune --prune-tags # 清理已删除的远程标签
2842
git fetch --tags -f # 强制更新所有标签
43+
# Lerna 发布
2944
- name: Publish with Lerna
3045
env:
3146
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)