-
Notifications
You must be signed in to change notification settings - Fork 10
551 lines (460 loc) · 19.4 KB
/
build-release.yml
File metadata and controls
551 lines (460 loc) · 19.4 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.1.0)'
required: true
type: string
permissions:
contents: write
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
jobs:
# ===========================================
# 1. Create Release + Version Bump
# ===========================================
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Releasing version: $VERSION"
- name: Bump version in project files
run: |
chmod +x ./scripts/bump-version.sh
./scripts/bump-version.sh "${{ steps.get_version.outputs.version }}"
- name: Commit version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml; then
echo "No version changes to commit"
else
git add package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml
git commit -m "chore: bump version to ${{ steps.get_version.outputs.version }} [skip ci]"
git push origin HEAD:main
fi
- name: Create tag (for workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
TAG_NAME="v${{ steps.get_version.outputs.version }}"
if ! git tag -l | grep -q "^${TAG_NAME}$"; then
git tag -a "${TAG_NAME}" -m "Release ${{ steps.get_version.outputs.version }}"
git push origin "${TAG_NAME}"
fi
- name: Create draft release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: ZeroLimit v${{ steps.get_version.outputs.version }}
draft: true
generate_release_notes: true
body: |
> ⚠️ **Note**: macOS builds won't be code-signed unless you add Apple signing secrets. Unsigned macOS apps require users to run:
> ```bash
> xattr -cr /Applications/ZeroLimit.app
> ```
# ===========================================
# 2. Build Windows x64
# ===========================================
build-windows-x64:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-x64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (x64)
run: pnpm tauri build --target x86_64-pc-windows-msvc
- name: Rename and Prepare artifacts
shell: bash
run: |
VERSION="${{ needs.create-release.outputs.version }}"
# Portable EXE
cp src-tauri/target/x86_64-pc-windows-msvc/release/zero-limit.exe "ZeroLimit_${VERSION}_Windows_x64_portable.exe"
# NSIS Installer
mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/ZeroLimit_${VERSION}_x64-setup.exe "ZeroLimit_${VERSION}_Windows_x64-setup.exe"
mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/ZeroLimit_${VERSION}_x64-setup.exe.sig "ZeroLimit_${VERSION}_Windows_x64-setup.exe.sig"
# MSI Installer
mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/ZeroLimit_${VERSION}_x64_en-US.msi "ZeroLimit_${VERSION}_Windows_x64.msi"
mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/ZeroLimit_${VERSION}_x64_en-US.msi.sig "ZeroLimit_${VERSION}_Windows_x64.msi.sig"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
ZeroLimit_*_Windows_x64-setup.exe
ZeroLimit_*_Windows_x64-setup.exe.sig
ZeroLimit_*_Windows_x64.msi
ZeroLimit_*_Windows_x64.msi.sig
ZeroLimit_*_Windows_x64_portable.exe
- name: Upload signatures for latest.json
uses: actions/upload-artifact@v4
with:
name: signatures-windows-x64
path: ZeroLimit_*_Windows_x64-setup.exe.sig
# ===========================================
# 3. Build Windows ARM64
# ===========================================
build-windows-arm64:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-pc-windows-msvc
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (ARM64)
run: pnpm tauri build --target aarch64-pc-windows-msvc
- name: Rename and Prepare artifacts
shell: bash
run: |
VERSION="${{ needs.create-release.outputs.version }}"
# Portable EXE
cp src-tauri/target/aarch64-pc-windows-msvc/release/zero-limit.exe "ZeroLimit_${VERSION}_Windows_arm64_portable.exe"
# NSIS Installer
mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/ZeroLimit_${VERSION}_arm64-setup.exe "ZeroLimit_${VERSION}_Windows_arm64-setup.exe"
mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/ZeroLimit_${VERSION}_arm64-setup.exe.sig "ZeroLimit_${VERSION}_Windows_arm64-setup.exe.sig"
# MSI Installer
mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/ZeroLimit_${VERSION}_arm64_en-US.msi "ZeroLimit_${VERSION}_Windows_arm64.msi"
mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/ZeroLimit_${VERSION}_arm64_en-US.msi.sig "ZeroLimit_${VERSION}_Windows_arm64.msi.sig"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
ZeroLimit_*_Windows_arm64-setup.exe
ZeroLimit_*_Windows_arm64-setup.exe.sig
ZeroLimit_*_Windows_arm64.msi
ZeroLimit_*_Windows_arm64.msi.sig
ZeroLimit_*_Windows_arm64_portable.exe
- name: Upload signatures for latest.json
uses: actions/upload-artifact@v4
with:
name: signatures-windows-arm64
path: ZeroLimit_*_Windows_arm64-setup.exe.sig
# ===========================================
# 4. Build macOS Intel (x64)
# ===========================================
build-macos-x64:
needs: create-release
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-x64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (Intel)
run: pnpm tauri build --target x86_64-apple-darwin
- name: Rename and Prepare artifacts
run: |
VERSION="${{ needs.create-release.outputs.version }}"
# Rename Intel artifacts
mv src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/ZeroLimit_${VERSION}_x64.dmg "ZeroLimit_${VERSION}_macOS_x64.dmg"
mv src-tauri/target/x86_64-apple-darwin/release/bundle/macos/ZeroLimit.app.tar.gz "ZeroLimit_${VERSION}_macOS_x64.app.tar.gz"
mv src-tauri/target/x86_64-apple-darwin/release/bundle/macos/ZeroLimit.app.tar.gz.sig "ZeroLimit_${VERSION}_macOS_x64.app.tar.gz.sig"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
ZeroLimit_*_macOS_x64.dmg
ZeroLimit_*_macOS_x64.app.tar.gz
ZeroLimit_*_macOS_x64.app.tar.gz.sig
- name: Upload signatures for latest.json
uses: actions/upload-artifact@v4
with:
name: signatures-macos-x64
path: ZeroLimit_*_macOS_x64.app.tar.gz.sig
# ===========================================
# 5. Build macOS Apple Silicon (ARM64)
# ===========================================
build-macos-arm64:
needs: create-release
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (Apple Silicon)
run: pnpm tauri build --target aarch64-apple-darwin
- name: Rename and Prepare artifacts
run: |
VERSION="${{ needs.create-release.outputs.version }}"
# Rename Apple Silicon artifacts
mv src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/ZeroLimit_${VERSION}_aarch64.dmg "ZeroLimit_${VERSION}_macOS_aarch64.dmg"
mv src-tauri/target/aarch64-apple-darwin/release/bundle/macos/ZeroLimit.app.tar.gz "ZeroLimit_${VERSION}_macOS_aarch64.app.tar.gz"
mv src-tauri/target/aarch64-apple-darwin/release/bundle/macos/ZeroLimit.app.tar.gz.sig "ZeroLimit_${VERSION}_macOS_aarch64.app.tar.gz.sig"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
ZeroLimit_*_macOS_aarch64.dmg
ZeroLimit_*_macOS_aarch64.app.tar.gz
ZeroLimit_*_macOS_aarch64.app.tar.gz.sig
- name: Upload signatures for latest.json
uses: actions/upload-artifact@v4
with:
name: signatures-macos-arm64
path: ZeroLimit_*_macOS_aarch64.app.tar.gz.sig
# ===========================================
# 6. Build Linux x64
# ===========================================
build-linux:
needs: create-release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libssl-dev \
libgtk-3-dev \
libsoup-3.0-dev \
javascriptcoregtk-4.1-dev
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri
run: pnpm tauri build
- name: Rename and Prepare artifacts
run: |
VERSION="${{ needs.create-release.outputs.version }}"
echo "=== Listing build output directory ==="
ls -R src-tauri/target/release/bundle/
# Debian (using wildcard for safety)
find src-tauri/target/release/bundle/deb/ -name "*_${VERSION}_amd64.deb" -exec mv {} "ZeroLimit_${VERSION}_Linux_x64.deb" \;
# RPM (using wildcard for safety)
find src-tauri/target/release/bundle/rpm/ -name "*-${VERSION}-1.x86_64.rpm" -exec mv {} "ZeroLimit_${VERSION}_Linux_x64.rpm" \;
# AppImage (using wildcard for safety)
find src-tauri/target/release/bundle/appimage/ -name "*_${VERSION}_amd64.AppImage" -exec mv {} "ZeroLimit_${VERSION}_Linux_x64.AppImage" \;
# AppImage.tar.gz and signature (updater artifacts)
find src-tauri/target/release/bundle/appimage/ -name "*.AppImage.tar.gz" ! -name "*.sig" -exec mv {} "ZeroLimit_${VERSION}_Linux_x64.AppImage.tar.gz" \;
find src-tauri/target/release/bundle/appimage/ -name "*.AppImage.tar.gz.sig" -exec mv {} "ZeroLimit_${VERSION}_Linux_x64.AppImage.tar.gz.sig" \;
echo "=== Prepared artifacts in workspace ==="
ls -la ZeroLimit_* || echo "No artifacts found!"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
fail_on_unmatched_files: false
files: |
ZeroLimit_*_Linux_x64.deb
ZeroLimit_*_Linux_x64.rpm
ZeroLimit_*_Linux_x64.AppImage
ZeroLimit_*_Linux_x64.AppImage.tar.gz
ZeroLimit_*_Linux_x64.AppImage.tar.gz.sig
- name: Upload signatures for latest.json
uses: actions/upload-artifact@v4
with:
name: signatures-linux
path: ZeroLimit_*_Linux_x64.AppImage.tar.gz.sig
if-no-files-found: warn
# ===========================================
# 7. Publish Release + Generate latest.json
# ===========================================
publish-release:
needs: [create-release, build-windows-x64, build-windows-arm64, build-macos-x64, build-macos-arm64, build-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all signatures
uses: actions/download-artifact@v4
with:
pattern: signatures-*
merge-multiple: true
path: signatures
- name: List signatures (debug)
run: find signatures -type f | sort
- name: Generate latest.json
run: |
VERSION="${{ needs.create-release.outputs.version }}"
REPO="${{ github.repository }}"
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Read signature files
WIN_X64_SIG=$(find signatures -name "*Windows_x64-setup.exe.sig" | head -1 | xargs cat 2>/dev/null || echo "")
WIN_ARM64_SIG=$(find signatures -name "*Windows_arm64-setup.exe.sig" | head -1 | xargs cat 2>/dev/null || echo "")
MACOS_ARM64_SIG=$(find signatures -name "*macOS_aarch64.app.tar.gz.sig" | head -1 | xargs cat 2>/dev/null || echo "")
MACOS_X64_SIG=$(find signatures -name "*macOS_x64.app.tar.gz.sig" | head -1 | xargs cat 2>/dev/null || echo "")
LINUX_SIG=$(find signatures -name "*Linux_x64.AppImage.tar.gz.sig" | head -1 | xargs cat 2>/dev/null || echo "")
# Build platforms JSON dynamically
PLATFORMS="{"
if [ -n "$WIN_X64_SIG" ]; then
PLATFORMS="$PLATFORMS\"windows-x86_64\":{\"signature\":\"$WIN_X64_SIG\",\"url\":\"https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_Windows_x64-setup.exe\"},"
fi
if [ -n "$WIN_ARM64_SIG" ]; then
PLATFORMS="$PLATFORMS\"windows-aarch64\":{\"signature\":\"$WIN_ARM64_SIG\",\"url\":\"https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_Windows_arm64-setup.exe\"},"
fi
if [ -n "$MACOS_ARM64_SIG" ]; then
PLATFORMS="$PLATFORMS\"darwin-aarch64\":{\"signature\":\"$MACOS_ARM64_SIG\",\"url\":\"https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_macOS_aarch64.app.tar.gz\"},"
fi
if [ -n "$MACOS_X64_SIG" ]; then
PLATFORMS="$PLATFORMS\"darwin-x86_64\":{\"signature\":\"$MACOS_X64_SIG\",\"url\":\"https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_macOS_x64.app.tar.gz\"},"
fi
if [ -n "$LINUX_SIG" ]; then
PLATFORMS="$PLATFORMS\"linux-x86_64\":{\"signature\":\"$LINUX_SIG\",\"url\":\"https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_Linux_x64.AppImage.tar.gz\"},"
fi
# Remove trailing comma and close
PLATFORMS="${PLATFORMS%,}}"
# Write latest.json
echo "{\"version\":\"$VERSION\",\"notes\":\"See release notes on GitHub\",\"pub_date\":\"$DATE\",\"platforms\":$PLATFORMS}" | jq '.' > latest.json
echo "Generated latest.json:"
cat latest.json
- name: Upload latest.json
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: false
files: latest.json