@@ -3,43 +3,51 @@ name: Release
33on :
44 push :
55 tags :
6- - ' v*' # 当你推送以 'v' 开头的 tag 时触发(例如 v1.0.0)
6+ - ' v*' # 推送 v1.0.0 等标签时触发
7+
8+ # 并发策略:如果同一个 tag 触发了多次,自动取消之前的构建
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress : true
712
813jobs :
914 release :
1015 permissions :
11- contents : write # 允许创建 Release 和上传文件
16+ contents : write # 必须: 允许创建 Release 和上传附件
1217 strategy :
13- fail-fast : false # 即使 Linux 失败了,Windows 和 Mac 也会继续打包完,不会全部中止
18+ fail-fast : false # 即使某个系统构建失败,其他系统也会继续完成
1419 matrix :
15- platform : [macos-latest, ubuntu-22.04, windows-latest]
20+ # 优化:使用 ubuntu-24.04,macOS-latest 在 2026 年通常指代 M2/M3 芯片环境
21+ platform : [macos-latest, ubuntu-24.04, windows-latest]
1622
1723 runs-on : ${{ matrix.platform }}
1824
1925 steps :
2026 - name : Checkout repository
2127 uses : actions/checkout@v4
2228
23- # 1. 配置 Node 环境并开启缓存
29+ # 1. 配置 Node.js 环境(启用 npm 缓存)
2430 - name : Setup Node.js
2531 uses : actions/setup-node@v4
2632 with :
2733 node-version : lts/*
28- cache : ' npm' # 开启 npm 缓存,加快依赖安装速度
34+ cache : ' npm'
2935
30- # 2. 配置 Rust 环境
36+ # 2. 配置 Rust 环境(启用 Rust 缓存)
3137 - name : Install Rust stable
3238 uses : dtolnay/rust-toolchain@stable
39+ with :
40+ # 增加编译目标支持(如果是 Mac 则自动处理 aarch64)
41+ targets : ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
3342
34- # 3. 开启 Rust 编译缓存 (极大地加快后续发版速度)
3543 - name : Rust Cache
3644 uses : Swatinem/rust-cache@v2
3745 with :
3846 workspaces : ' ./src-tauri -> target'
3947
40- # 4 . Linux 专属系统依赖 (包含 Tauri 核心框架和串口底层驱动 libudev)
48+ # 3 . Linux 专属依赖环境(针对 Ubuntu 24.04 优化)
4149 - name : Install dependencies (Ubuntu only)
42- if : matrix.platform == 'ubuntu-22.04'
50+ if : startsWith( matrix.platform, 'ubuntu')
4351 run : |
4452 sudo apt-get update
4553 sudo apt-get install -y \
@@ -50,18 +58,28 @@ jobs:
5058 librsvg2-dev \
5159 patchelf
5260
53- # 5 . 安装前端依赖
61+ # 4 . 安装前端依赖
5462 - name : Install frontend dependencies
5563 run : npm install
5664
57- # 6. 使用 Tauri 官方 Action 编译并发布到 Releases
65+ # 5. Tauri 官方构建 Action
5866 - name : Build and release Tauri app
5967 uses : tauri-apps/tauri-action@v0
6068 env :
6169 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6270 with :
63- tagName : ${{ github.ref_name }} # 自动获取当前触发的 tag
64- releaseName : ' Serial Tool ${{ github.ref_name }}' # 加上引号防止语法错误
65- releaseBody : ' 自动编译发布的版本。请在下方下载对应系统的安装包。'
71+ # 自动使用触发构建的 Tag 名称
72+ tagName : ${{ github.ref_name }}
73+ releaseName : ' Serial Tool ${{ github.ref_name }}'
74+ releaseBody : |
75+ ## 🚀 自动编译发布
76+ - 版本: ${{ github.ref_name }}
77+ - 日期: ${{ github.event.head_commit.timestamp }}
78+ - 提交信息: ${{ github.event.head_commit.message }}
79+
80+ 请在下方根据你的操作系统下载对应的安装包:
81+ - Windows: `.msi` 或 `.exe`
82+ - macOS: `.dmg` 或 `.app`
83+ - Linux: `.deb` 或 `AppImage`
6684 releaseDraft : false
6785 prerelease : false
0 commit comments