-
Notifications
You must be signed in to change notification settings - Fork 10
127 lines (114 loc) · 4.18 KB
/
build-desktop.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: 构建 Tauri 桌面版本
on:
- push
- workflow_dispatch
jobs:
clean-pre-release:
name: 删除预发布版本的构建产物
runs-on: ubuntu-22.04
steps:
- name: 删除预发布版本的构建产物
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
assets: |
*.*
tag: ${{ github.ref_name }}-dev
fail-if-no-assets: false
fail-if-no-release: false
build-tauri-desktop:
name: 构建 Tauri 桌面版本
needs: clean-pre-release
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
args: ""
name: linux
arch: x86_64
- platform: windows-latest
args: ""
name: windows
arch: x86_64
- platform: macos-latest # arm64 二进制包
args: "--target aarch64-apple-darwin"
name: macOS
arch: aarch64
- platform: macos-latest # x86 二进制包
args: "--target x86_64-apple-darwin"
name: macOS
arch: x86_64
- platform: macos-latest # 通用二进制包
args: "--target universal-apple-darwin"
name: macOS
arch: universal
runs-on: ${{ matrix.platform }}
steps:
- name: 克隆仓库
uses: actions/[email protected]
with:
fetch-depth: 0
submodules: recursive
- name: 缓存 Cargo 产物
uses: actions/[email protected]
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: 安装 PNPM
uses: pnpm/[email protected]
with:
version: latest
- name: 安装 Node.js
uses: actions/[email protected]
with:
node-version: lts/*
cache: pnpm
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: 安装 wasm32 目标
run: rustup target add wasm32-unknown-unknown
# macOS 自带的 Xcode LLVM 不支持 WASM 目标
- name: "macOS: 安装 LLVM 和 Clang"
uses: KyleMayes/install-llvm-action@v2
if: matrix.platform == 'macos-latest'
with:
version: "15"
- name: 安装 Tauri 所需系统依赖(仅 Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libappindicator3-dev libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: 安装前端依赖
run: pnpm i
- name: 构建 AMLL TTML Tools 程序并发布自动构建
uses: tauri-apps/[email protected]
with:
tagName: ${{ github.ref_name }}-dev
includeUpdaterJson: true
releaseName: AMLL TTML Tools ${{ github.ref_name }} branch development build
releaseBody: |
Latest ${{ github.ref_name }} branch development build.
最新 ${{ github.ref_name }} 分支开发调试构建。
Development version may be unstable and may not work properly, please only for test purpose.
开发版本可能不稳定且可能无法正常工作,请仅用于测试目的。
Latest commits (最新提交): ${{ github.event.head_commit.message }}
prerelease: true
args: ${{ matrix.args }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 上传产物到 Action Artifact
uses: actions/[email protected]
with:
name: AMLL TTML Tools ${{matrix.name}}-${{matrix.arch}}
path: |
src-tauri/target/**/release/bundle/**/*
src-tauri/target/**/release/AMLL TTML Tool.exe
src-tauri/target/**/release/AMLL TTML Tool