-
Notifications
You must be signed in to change notification settings - Fork 338
110 lines (100 loc) · 2.97 KB
/
release.yml
File metadata and controls
110 lines (100 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# ClawPanel 发布构建工作流
# 推送 v* 标签时自动构建跨平台产物并创建 GitHub Release
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: '发布版本号 (例如: v1.0.0)'
required: true
type: string
default: 'v1.0.0'
jobs:
release:
name: 构建 (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform:
# macOS Apple Silicon (ARM64)
- 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
args: ""
rust_target: ""
# Windows x86_64
- name: Windows (x64)
os: windows-latest
args: ""
rust_target: ""
steps:
# 签出代码
- name: 签出代码
uses: actions/checkout@v4
# 安装 Node.js 22
- name: 安装 Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
# 安装前端依赖
- name: 安装前端依赖
run: npm ci
# 安装 Rust 工具链 (stable)
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.rust_target }}
# Rust 编译缓存
- name: Rust 编译缓存
uses: swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
# Linux 专用: 安装 Tauri v2 系统依赖
- name: 安装 Linux 系统依赖
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libssl-dev \
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: ${{ env.TAG_NAME }}
releaseName: "ClawPanel ${{ env.TAG_NAME }}"
releaseBody: "详细变更记录请查看提交历史。"
releaseDraft: false
prerelease: false
args: ${{ matrix.platform.args }}