Skip to content

Commit 5c63899

Browse files
committed
ci: 增强 release 工作流支持手动触发和全平台构建
- 添加 workflow_dispatch 手动触发入口 - 新增 macOS Intel (x86_64) 构建目标 - Linux 固定 ubuntu-22.04 提升向下兼容性 - 修复 Windows 下 shell 兼容问题
1 parent 3ac02ea commit 5c63899

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
push:
77
tags:
88
- "v*"
9+
workflow_dispatch:
10+
inputs:
11+
tag_name:
12+
description: '发布版本号 (例如: v1.0.0)'
13+
required: true
14+
type: string
15+
default: 'v1.0.0'
916

1017
jobs:
1118
release:
@@ -21,14 +28,22 @@ jobs:
2128
- name: macOS (ARM64)
2229
os: macos-latest
2330
args: --target aarch64-apple-darwin
31+
rust_target: aarch64-apple-darwin
32+
# macOS Intel (x64)
33+
- name: macOS (Intel)
34+
os: macos-latest
35+
args: --target x86_64-apple-darwin
36+
rust_target: x86_64-apple-darwin
2437
# Linux x86_64
2538
- name: Linux (x64)
26-
os: ubuntu-latest
39+
os: ubuntu-22.04
2740
args: ""
41+
rust_target: ""
2842
# Windows x86_64
2943
- name: Windows (x64)
3044
os: windows-latest
3145
args: ""
46+
rust_target: ""
3247

3348
steps:
3449
# 签出代码
@@ -50,8 +65,7 @@ jobs:
5065
- name: 安装 Rust 工具链
5166
uses: dtolnay/rust-toolchain@stable
5267
with:
53-
# macOS ARM64 需要指定 target
54-
targets: ${{ matrix.platform.os == 'macos-latest' && 'aarch64-apple-darwin' || '' }}
68+
targets: ${{ matrix.platform.rust_target }}
5569

5670
# Rust 编译缓存
5771
- name: Rust 编译缓存
@@ -61,7 +75,7 @@ jobs:
6175

6276
# Linux 专用: 安装 Tauri v2 系统依赖
6377
- name: 安装 Linux 系统依赖
64-
if: matrix.platform.os == 'ubuntu-latest'
78+
if: matrix.platform.os == 'ubuntu-22.04'
6579
run: |
6680
sudo apt-get update
6781
sudo apt-get install -y \
@@ -73,15 +87,25 @@ jobs:
7387
libgtk-3-dev \
7488
libayatana-appindicator3-dev
7589
90+
- name: 设置 Release 标签
91+
id: vars
92+
shell: bash
93+
run: |
94+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
95+
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
96+
else
97+
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
98+
fi
99+
76100
# 使用 tauri-action 构建并发布
77101
- name: 构建 Tauri 应用
78102
uses: tauri-apps/tauri-action@v0
79103
env:
80104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81105
with:
82-
tagName: ${{ github.ref_name }}
83-
releaseName: "ClawPanel ${{ github.ref_name }}"
106+
tagName: ${{ env.TAG_NAME }}
107+
releaseName: "ClawPanel ${{ env.TAG_NAME }}"
84108
releaseBody: "详细变更记录请查看提交历史。"
85-
releaseDraft: true
109+
releaseDraft: false
86110
prerelease: false
87111
args: ${{ matrix.platform.args }}

0 commit comments

Comments
 (0)