Skip to content

Commit 5f9add8

Browse files
committed
chore(ci): 更新 GitHub Actions 工作流多平台分开独立构建
1 parent d12fb4e commit 5f9add8

File tree

2 files changed

+44
-21
lines changed

2 files changed

+44
-21
lines changed

.github/workflows/package.yaml

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,62 @@ name: Build Electron App
33
on:
44
push:
55
branches:
6-
- main # 每次 push 到 main 分支触发
6+
- main
77

88
jobs:
9-
build:
10-
strategy:
11-
matrix:
12-
os: [ubuntu-latest, windows-latest, macos-latest]
13-
runs-on: ${{ matrix.os }}
14-
9+
build_ubuntu:
10+
runs-on: ubuntu-latest
1511
steps:
1612
- name: Checkout code
1713
uses: actions/checkout@v4
18-
1914
- name: Set up Node.js
2015
uses: actions/setup-node@v4
2116
with:
2217
node-version: 18
23-
cache: "npm"
24-
2518
- name: Install dependencies
26-
run: |
27-
npm install --package-lock-only # 仅生成 package-lock.json
28-
npm install # 使用 npm 安装依赖
19+
run: npm install
20+
- name: Build project
21+
run: npm run build
22+
- name: Upload build artifacts
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: ubuntu-build
26+
path: dist_electron/
2927

28+
build_windows:
29+
runs-on: windows-latest
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
- name: Set up Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 18
37+
- name: Install dependencies
38+
run: npm install
3039
- name: Build project
31-
run: npm run build
40+
run: npm run build
41+
- name: Upload build artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: windows-build
45+
path: dist_electron/
3246

47+
build_macos:
48+
runs-on: macos-latest
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: 18
56+
- name: Install dependencies
57+
run: npm install
58+
- name: Build project
59+
run: npm run build
3360
- name: Upload build artifacts
3461
uses: actions/upload-artifact@v4
3562
with:
36-
name: ${{ matrix.os }}-build
37-
path: |
38-
dist_electron/ # 上传构建输出的文件
39-
40-
- name: Continue even if this fails (Optional)
41-
continue-on-error: true
63+
name: macos-build
64+
path: dist_electron/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
"vue-tsc": "^2.0.26"
4141
},
4242
"main": "dist-electron/main.js",
43-
"build-icon": "electron-icon-builder --input=./public/favicon.png --output=public --flatten"
43+
"build-icon": "electron-icon-builder --input=./public/icon.svg --output=public/icon --flatten"
4444
}

0 commit comments

Comments
 (0)