-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (185 loc) · 6.36 KB
/
Copy pathrust.yml
File metadata and controls
217 lines (185 loc) · 6.36 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Tauri Build
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
build_type:
description: 'Build type'
required: false
default: 'release'
type: choice
options:
- release
- debug
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- label: windows
os: windows-latest
target: x86_64-pc-windows-msvc
config-path: src-tauri/tauri.conf.json
- label: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
config-path: src-tauri/tauri.conf.json
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
RUSTC_WRAPPER: sccache
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libssl-dev \
libayatana-appindicator3-dev
# ── sccache (compiler cache) ──────────────────────────
- name: Start sccache
uses: mozilla-actions/sccache-action@v0.0.3
# ── Cargo / Rust cache ────────────────────────────────
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('src-tauri/Cargo.lock') }}
- name: Cache Cargo git
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: cargo-git-${{ hashFiles('src-tauri/Cargo.lock') }}
- name: Cache Tauri build target
uses: actions/cache@v4
with:
path: |
src-tauri/target
!src-tauri/target/release/bundle
key: ${{ matrix.label }}-target-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ matrix.label }}-target-
# ── Tauri CLI ─────────────────────────────────────────
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install Tauri CLI
run: cargo binstall tauri-cli --locked -y
- name: Verify Tauri CLI
run: cargo tauri --version
# ── Build Tauri application ───────────────────────────
- name: Clean previous bundle artifacts
shell: bash
run: rm -rf src-tauri/target/release/bundle
- name: Build Tauri application
run: cargo tauri build --config ${{ matrix.config-path }}
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# ── Rename artifacts with platform suffix ─────────────
- name: Rename artifacts with platform suffix
shell: bash
run: |
suffix=""
case "${{ matrix.label }}" in
linux) suffix="-linux" ;;
esac
if [ -n "$suffix" ]; then
find src-tauri/target/release/bundle -maxdepth 2 -type f \
\( -name '*.deb' -o -name '*.AppImage' -o -name '*.msi' -o -name '*.exe' \) \
-exec sh -c '
s="$1"; shift
for f; do
d="${f%.*}"
e="${f##*.}"
mv "$f" "${d}${s}.${e}"
done
' sh "$suffix" {} +
fi
- name: List build artifacts
shell: bash
run: |
echo "=== Build artifacts (${{ matrix.label }}) ==="
find src-tauri/target/release/bundle -maxdepth 2 -type f -exec ls -lh {} \;
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: viewstage-${{ matrix.label }}
path: src-tauri/target/release/bundle/
if-no-files-found: warn
retention-days: 30
create-release:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Only keep installer packages
shell: bash
run: |
find artifacts -type f \
! -name '*.msi' \
! -name '*.exe' \
! -name '*.deb' \
! -name '*.AppImage' \
-delete
- name: Generate release notes
id: notes
shell: bash
run: |
git fetch --tags --force 2>/dev/null || true
prev_tag=$(git tag --sort=-version:refname | head -2 | tail -1)
echo "## What's Changed" > /tmp/release-notes.md
if [ -n "$prev_tag" ]; then
git log "$prev_tag".."${{ github.ref_name }}" --oneline --no-decorate >> /tmp/release-notes.md 2>/dev/null || true
else
git log --oneline --no-decorate -20 >> /tmp/release-notes.md 2>/dev/null || true
fi
{
echo 'notes<<EOF'
cat /tmp/release-notes.md
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Determine prerelease status
id: prerelease
run: |
tag="${GITHUB_REF#refs/tags/}"
if echo "$tag" | grep -Eq -- '-(alpha|beta|rc)'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**
body: ${{ steps.notes.outputs.notes }}
draft: true
prerelease: ${{ steps.prerelease.outputs.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}