Skip to content

Commit d2675b0

Browse files
committed
chore: add GitHub Actions workflow
1 parent 1678b42 commit d2675b0

1 file changed

Lines changed: 308 additions & 0 deletions

File tree

.github/workflows/release1.yml

Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
name: Build ZFileTimeMachine Artifacts
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- "src/**"
9+
- "src-tauri/**"
10+
- "package.json"
11+
- "pnpm-lock.yaml"
12+
- "vite.config.ts"
13+
- ".github/workflows/build.yml"
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: ${{ github.event_name == 'push' }}
18+
19+
env:
20+
CARGO_TERM_COLOR: always
21+
RUST_BACKTRACE: short
22+
23+
COREPACK_ENABLE_AUTO_PIN: "0"
24+
COREPACK_ENABLE_STRICT: "0"
25+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
26+
27+
jobs:
28+
29+
build-windows:
30+
name: Windows x64
31+
runs-on: windows-2025
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up pnpm
38+
uses: pnpm/action-setup@v4
39+
40+
- name: Set up Node.js 24
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 24
44+
cache: pnpm
45+
46+
- name: Set up Rust (stable)
47+
uses: dtolnay/rust-toolchain@stable
48+
49+
- name: Prepend Cargo bin to PATH
50+
shell: pwsh
51+
run: |
52+
"$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
53+
54+
- name: Rust build cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
workspaces: src-tauri
58+
cache-on-failure: true
59+
60+
- name: Install frontend dependencies
61+
run: pnpm install --frozen-lockfile
62+
63+
- name: Build — NSIS + MSI
64+
run: pnpm tauri build --bundles nsis,msi
65+
66+
- name: List bundle output
67+
if: always()
68+
shell: pwsh
69+
run: |
70+
Write-Host "=== NSIS ==="
71+
Get-ChildItem -Recurse src-tauri\target\release\bundle\nsis -ErrorAction SilentlyContinue
72+
Write-Host "=== MSI ==="
73+
Get-ChildItem -Recurse src-tauri\target\release\bundle\msi -ErrorAction SilentlyContinue
74+
75+
- name: Upload Windows artifacts
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: windows-x64
79+
path: |
80+
src-tauri/target/release/bundle/nsis/*.exe
81+
src-tauri/target/release/bundle/msi/*.msi
82+
if-no-files-found: error
83+
retention-days: 30
84+
85+
86+
build-macos-intel:
87+
name: macOS Intel x64
88+
runs-on: macos-latest
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v4
93+
94+
- name: Set up pnpm
95+
uses: pnpm/action-setup@v4
96+
97+
- name: Set up Node.js 24
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version: 24
101+
cache: pnpm
102+
103+
- name: Set up Rust (stable)
104+
uses: dtolnay/rust-toolchain@stable
105+
106+
- name: Prepend Cargo bin to PATH
107+
run: |
108+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
109+
echo "CARGO=$HOME/.cargo/bin/cargo" >> $GITHUB_ENV
110+
111+
- name: Add x86_64-apple-darwin target
112+
run: rustup target add x86_64-apple-darwin
113+
114+
- name: Rust build cache
115+
uses: Swatinem/rust-cache@v2
116+
with:
117+
workspaces: src-tauri
118+
cache-on-failure: true
119+
key: macos-intel
120+
121+
- name: Install frontend dependencies
122+
run: pnpm install --frozen-lockfile
123+
124+
- name: Build — DMG (Intel x64)
125+
run: pnpm tauri build --bundles dmg --target x86_64-apple-darwin
126+
env:
127+
APPLE_SIGNING_IDENTITY: "-"
128+
CSC_IDENTITY_AUTO_DISCOVERY: "false"
129+
130+
- name: List bundle output
131+
if: always()
132+
run: |
133+
find src-tauri/target/x86_64-apple-darwin/release/bundle -type f 2>/dev/null || echo "(not found)"
134+
135+
- name: Upload macOS Intel artifact
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: macos-intel-x64
139+
path: src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/*.dmg
140+
if-no-files-found: error
141+
retention-days: 30
142+
143+
144+
build-macos-silicon:
145+
name: macOS Apple Silicon
146+
runs-on: macos-latest
147+
148+
steps:
149+
- name: Checkout
150+
uses: actions/checkout@v4
151+
152+
- name: Set up pnpm
153+
uses: pnpm/action-setup@v4
154+
155+
- name: Set up Node.js 24
156+
uses: actions/setup-node@v4
157+
with:
158+
node-version: 24
159+
cache: pnpm
160+
161+
- name: Set up Rust (stable)
162+
uses: dtolnay/rust-toolchain@stable
163+
164+
- name: Prepend Cargo bin to PATH
165+
run: |
166+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
167+
echo "CARGO=$HOME/.cargo/bin/cargo" >> $GITHUB_ENV
168+
169+
- name: Rust build cache
170+
uses: Swatinem/rust-cache@v2
171+
with:
172+
workspaces: src-tauri
173+
cache-on-failure: true
174+
key: macos-silicon
175+
176+
- name: Install frontend dependencies
177+
run: pnpm install --frozen-lockfile
178+
179+
- name: Build — DMG (Apple Silicon)
180+
run: pnpm tauri build --bundles dmg
181+
env:
182+
APPLE_SIGNING_IDENTITY: "-"
183+
CSC_IDENTITY_AUTO_DISCOVERY: "false"
184+
185+
- name: List bundle output
186+
if: always()
187+
run: |
188+
find src-tauri/target/release/bundle -type f 2>/dev/null || echo "(not found)"
189+
190+
- name: Upload macOS Apple Silicon artifact
191+
uses: actions/upload-artifact@v4
192+
with:
193+
name: macos-apple-silicon
194+
path: src-tauri/target/release/bundle/dmg/*.dmg
195+
if-no-files-found: error
196+
retention-days: 30
197+
198+
199+
build-linux:
200+
name: Linux x64
201+
runs-on: ubuntu-22.04
202+
203+
steps:
204+
- name: Checkout
205+
uses: actions/checkout@v4
206+
207+
- name: Install system dependencies
208+
run: |
209+
sudo apt-get update
210+
sudo apt-get install -y \
211+
build-essential \
212+
libwebkit2gtk-4.1-dev \
213+
libayatana-appindicator3-dev \
214+
librsvg2-dev \
215+
libssl-dev \
216+
libxdo-dev \
217+
libfuse2 \
218+
patchelf \
219+
rpm \
220+
libdbus-1-dev \
221+
pkg-config
222+
223+
- name: Set up pnpm
224+
uses: pnpm/action-setup@v4
225+
226+
- name: Set up Node.js 24
227+
uses: actions/setup-node@v4
228+
with:
229+
node-version: 24
230+
cache: pnpm
231+
232+
- name: Set up Rust (stable)
233+
uses: dtolnay/rust-toolchain@stable
234+
235+
- name: Prepend Cargo bin to PATH
236+
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
237+
238+
- name: Rust build cache
239+
uses: Swatinem/rust-cache@v2
240+
with:
241+
workspaces: src-tauri
242+
cache-on-failure: true
243+
key: linux-x64
244+
245+
- name: Install frontend dependencies
246+
run: pnpm install --frozen-lockfile
247+
248+
- name: Build — deb + AppImage + rpm
249+
run: pnpm tauri build --bundles deb,appimage,rpm
250+
env:
251+
APPIMAGE_EXTRACT_AND_RUN: "1"
252+
253+
- name: List bundle output
254+
if: always()
255+
run: |
256+
find src-tauri/target/release/bundle -type f 2>/dev/null || echo "(not found)"
257+
258+
- name: Upload Linux artifacts
259+
uses: actions/upload-artifact@v4
260+
with:
261+
name: linux-x64
262+
path: |
263+
src-tauri/target/release/bundle/deb/*.deb
264+
src-tauri/target/release/bundle/appimage/*.AppImage
265+
src-tauri/target/release/bundle/rpm/*.rpm
266+
if-no-files-found: error
267+
retention-days: 30
268+
269+
270+
collect:
271+
name: Collect all release artifacts
272+
needs: [build-windows, build-macos-intel, build-macos-silicon, build-linux]
273+
runs-on: ubuntu-22.04
274+
if: always() && !cancelled()
275+
276+
steps:
277+
- name: Download all artifacts
278+
uses: actions/download-artifact@v4
279+
with:
280+
path: dist
281+
282+
- name: Flatten into release/
283+
run: |
284+
mkdir -p release
285+
find dist -type f \( \
286+
-name '*.msi' -o \
287+
-name '*.exe' -o \
288+
-name '*.dmg' -o \
289+
-name '*.deb' -o \
290+
-name '*.rpm' -o \
291+
-name '*.AppImage' \
292+
\) -exec cp {} release/ \;
293+
echo "=== release/ ==="
294+
ls -lah release/
295+
296+
- name: Generate SHA-256 checksums
297+
run: |
298+
cd release
299+
(sha256sum *.msi *.exe *.dmg *.deb *.rpm *.AppImage 2>/dev/null || true) > SHA256SUMS.txt
300+
cat SHA256SUMS.txt
301+
302+
- name: Upload combined release bundle
303+
uses: actions/upload-artifact@v4
304+
with:
305+
name: zfiletimemachine-release-all
306+
path: release/*
307+
if-no-files-found: error
308+
retention-days: 90

0 commit comments

Comments
 (0)