File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Cross-Platform Build Test (三环境构建测试)
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ build :
11+ # 核心:使用矩阵 strategy.matrix.os 来定义运行环境
12+ runs-on : ${{ matrix.os }}
13+
14+ strategy :
15+ # 定义构建矩阵
16+ matrix :
17+ # 列出所有需要构建的操作系统环境
18+ os : [ubuntu-latest, macos-latest, windows-latest]
19+ # 可以指定要使用的 Bun 版本
20+ bun-version : [latest]
21+
22+ steps :
23+ - name : 📝 检出代码
24+ uses : actions/checkout@v4
25+
26+ - name : 🛠️ 设置 Bun (${{ matrix.bun-version }})
27+ # 使用官方 Action 来安装 Bun
28+ uses : oven-sh/setup-bun@v1
29+ with :
30+ bun-version : ${{ matrix.bun-version }}
31+
32+ - name : 📦 安装依赖 (bun install)
33+ # --frozen-lockfile 确保使用 package.json 的锁定文件
34+ run : bun install --frozen-lockfile
35+ # 注意:在 Windows 上,这个 run 语句会自动使用 PowerShell 或 CMD 执行。
36+
37+ - name : 🔨 执行构建 (bun run build)
38+ run : bun run build
39+
40+ # 可选步骤:如果构建成功,将构建产物打包上传,方便后续检查或部署
41+ - name : 💾 存档构建结果 (${{ matrix.os }})
42+ uses : actions/upload-artifact@v4
43+ with :
44+ # 不同的操作系统,构建产物的名称不同,方便区分
45+ name : build-artifacts-${{ matrix.os }}
46+ path : dist # 假设你的构建输出目录是 dist
47+ if-no-files-found : error # 如果没有找到 dist 目录,则报错
You can’t perform that action at this time.
0 commit comments