ci: 增强 release 工作流支持手动触发和全平台构建

- 添加 workflow_dispatch 手动触发入口
- 新增 macOS Intel (x86_64) 构建目标
- Linux 固定 ubuntu-22.04 提升向下兼容性
- 修复 Windows 下 shell 兼容问题
This commit is contained in:
晴天
2026-03-01 13:46:04 +08:00
parent 3ac02ea19f
commit 5c638994e5

View File

@@ -6,6 +6,13 @@ on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: '发布版本号 (例如: v1.0.0)'
required: true
type: string
default: 'v1.0.0'
jobs:
release:
@@ -21,14 +28,22 @@ jobs:
- name: macOS (ARM64)
os: macos-latest
args: --target aarch64-apple-darwin
rust_target: aarch64-apple-darwin
# macOS Intel (x64)
- name: macOS (Intel)
os: macos-latest
args: --target x86_64-apple-darwin
rust_target: x86_64-apple-darwin
# Linux x86_64
- name: Linux (x64)
os: ubuntu-latest
os: ubuntu-22.04
args: ""
rust_target: ""
# Windows x86_64
- name: Windows (x64)
os: windows-latest
args: ""
rust_target: ""
steps:
# 签出代码
@@ -50,8 +65,7 @@ jobs:
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
with:
# macOS ARM64 需要指定 target
targets: ${{ matrix.platform.os == 'macos-latest' && 'aarch64-apple-darwin' || '' }}
targets: ${{ matrix.platform.rust_target }}
# Rust 编译缓存
- name: Rust 编译缓存
@@ -61,7 +75,7 @@ jobs:
# Linux 专用: 安装 Tauri v2 系统依赖
- name: 安装 Linux 系统依赖
if: matrix.platform.os == 'ubuntu-latest'
if: matrix.platform.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
@@ -73,15 +87,25 @@ jobs:
libgtk-3-dev \
libayatana-appindicator3-dev
- name: 设置 Release 标签
id: vars
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
else
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
fi
# 使用 tauri-action 构建并发布
- name: 构建 Tauri 应用
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: "ClawPanel ${{ github.ref_name }}"
tagName: ${{ env.TAG_NAME }}
releaseName: "ClawPanel ${{ env.TAG_NAME }}"
releaseBody: "详细变更记录请查看提交历史。"
releaseDraft: true
releaseDraft: false
prerelease: false
args: ${{ matrix.platform.args }}