Skip to content

Commit 4f12b5f

Browse files
committed
feat: 更新构建工作流以支持主分支和简化构建步骤
1 parent 1ceaf2b commit 4f12b5f

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
name: Build Extension
1+
name: Build Browser Extension
22

33
on:
44
push:
5-
branches: [extension]
6-
pull_request:
7-
branches: [extension]
5+
branches:
6+
- main
7+
- master
88
workflow_dispatch:
99

1010
jobs:
1111
build:
12-
name: Build ${{ matrix.browser }} Extension
1312
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
browser: [chrome, firefox]
13+
1714
steps:
15+
# 1. 检出代码
1816
- name: Checkout repository
1917
uses: actions/checkout@v4
2018

19+
# 2. 安装 pnpm
2120
- name: Setup pnpm
2221
uses: pnpm/action-setup@v4
2322
with:
24-
version: 10.33.2
23+
version: 10 # 根据你项目使用的 pnpm 版本调整
2524

25+
# 3. 配置 Node.js 并启用 pnpm 缓存
2626
- name: Setup Node.js
2727
uses: actions/setup-node@v4
2828
with:
29-
node-version: "20"
30-
cache: "pnpm"
29+
node-version: '24' # 根据项目需要选择 Node 版本
30+
cache: 'pnpm'
3131

32+
# 4. 安装依赖
3233
- name: Install dependencies
3334
run: pnpm install --frozen-lockfile
3435

35-
- name: Build ${{ matrix.browser }} extension
36+
# 5. 构建 Chrome (zip) 与 Firefox (zip:firefox) 两个版本
37+
- name: Build extension packages
3638
run: |
37-
if [ "${{ matrix.browser }}" = "chrome" ]; then
38-
pnpm zip
39-
else
40-
pnpm zip:firefox
41-
fi
39+
pnpm zip
40+
pnpm zip:firefox
4241
43-
- name: Upload extension zip
42+
# 6. 上传 ZIP 产物(请根据实际输出目录调整路径)
43+
# 常见的 WXT 输出位置是 .output/,也可能在 dist/ 下
44+
- name: Upload ZIP artifacts
4445
uses: actions/upload-artifact@v4
4546
with:
46-
name: tmurf-${{ matrix.browser }}-*
47-
path: .output/*.zip
48-
retention-days: 30
47+
name: extension-packages
48+
path: .output/*.zip

0 commit comments

Comments
 (0)