-
Notifications
You must be signed in to change notification settings - Fork 749
766 lines (676 loc) · 30.8 KB
/
release-app.yml
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
# # Run for macOS
# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j publish-tauri -P macos-latest=-self-hosted
name: Release App
on:
workflow_dispatch:
inputs:
commit_hash:
description: "Commit hash to build from (optional)"
required: false
version:
description: "Version to set in Cargo.toml (required if commit_hash is provided)"
required: false
push:
branches: [main]
jobs:
check_commit:
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.check.outputs.should_release }}
should_publish: ${{ steps.check.outputs.should_publish }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: check
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
if echo "$COMMIT_MSG" | grep -q "release-app"; then
echo "should_release=true" >> $GITHUB_OUTPUT
else
echo "should_release=false" >> $GITHUB_OUTPUT
fi
if echo "$COMMIT_MSG" | grep -q "release-app-publish"; then
echo "should_publish=true" >> $GITHUB_OUTPUT
else
echo "should_publish=false" >> $GITHUB_OUTPUT
fi
generate_changelog:
needs: check_commit
if: github.event_name == 'workflow_dispatch' || needs.check_commit.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from Cargo.toml if not provided
id: get_version
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
VERSION=$(grep '^version = ' screenpipe-app-tauri/src-tauri/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
fi
- name: Generate Changelog
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CN_API_KEY: ${{ secrets.CN_API_KEY }}
run: .github/scripts/generate_changelog_md.sh ${{ env.VERSION }} ${{ github.event.inputs.commit_hash }}
- name: Commit and push changelog files
if: env.CHANGELOG_GENERATED == 1
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git add .
git commit -m "docs: add changelog for ${{ env.VERSION }}"
git pull origin main
git push origin main
draft:
needs: [check_commit, generate_changelog]
if: github.event_name == 'workflow_dispatch' || needs.check_commit.outputs.should_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_hash || github.ref }}
- name: Update version in Cargo.toml
if: github.event.inputs.commit_hash && github.event.inputs.version
run: |
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/^version = ".*"/version = "${{ github.event.inputs.version }}"/' screenpipe-app-tauri/src-tauri/Cargo.toml
else
sed -i 's/^version = ".*"/version = "${{ github.event.inputs.version }}"/' screenpipe-app-tauri/src-tauri/Cargo.toml
fi
- name: create draft release
uses: crabnebula-dev/[email protected]
with:
command: release draft ${{ secrets.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
publish-tauri:
needs: [check_commit, draft]
if: github.event_name == 'workflow_dispatch' || needs.check_commit.outputs.should_release == 'true'
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin --features metal,beta"
target: aarch64-apple-darwin
tauri-args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin --features metal,beta"
target: x86_64-apple-darwin
tauri-args: "--target x86_64-apple-darwin"
- platform: [self-hosted, Windows, X64] # Windows x86_64
args: "--target x86_64-pc-windows-msvc --features mkl" # TODO CUDA --features "openblas"
pre-build-args: "" # --openblas
tauri-args: "--target x86_64-pc-windows-msvc"
runs-on: ${{ matrix.platform }}
steps:
- name: Enable Git long paths on Windows
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
run: |
Write-Host "Enabling git core.longpaths..."
git config --system core.longpaths true
# Verify the setting
$longpaths = git config --system --get core.longpaths
Write-Host "core.longpaths is set to: $longpaths"
if ($longpaths -ne "true") {
throw "Failed to enable git long paths"
}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_hash || github.ref }}
- name: Update version in Cargo.toml
if: github.event.inputs.commit_hash && github.event.inputs.version && matrix.platform != 'macos-latest'
shell: pwsh
run: |
$content = Get-Content screenpipe-app-tauri/src-tauri/Cargo.toml
$content = $content -replace '^version = ".*"', ('version = "' + '${{ github.event.inputs.version }}' + '"')
$content | Set-Content screenpipe-app-tauri/src-tauri/Cargo.toml -Force
- name: Update version in Cargo.toml
if: github.event.inputs.commit_hash && github.event.inputs.version && matrix.platform == 'macos-latest'
shell: bash
run: |
sed -i '' 's/^version = ".*"/version = "${{ github.event.inputs.version }}"/' screenpipe-app-tauri/src-tauri/Cargo.toml
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.43
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Rust
if: matrix.tauri-args != '--target x86_64-pc-windows-msvc'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Install Rust
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
run: |
Invoke-WebRequest https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile rustup-init.exe
.\rustup-init.exe -y
- name: setup rust path
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
run: |
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
rustc --version # verify rust is available
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
# Specify custom cache key
key: ${{ runner.os }}-rust-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
# Cache these paths
cache-directories: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/${{ matrix.target }}
screenpipe-app-tauri/src-tauri/target
# Shared cache across branches
shared-key: "rust-cache-${{ matrix.target }}"
# Save cache even on failed builds
save-if: true
- name: Cache Build Artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/${{ matrix.target }}/release
screenpipe-app-tauri/src-tauri/target/release
key: ${{ runner.os }}-artifacts-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-artifacts-${{ matrix.target }}-
- name: Cache Homebrew packages
if: matrix.platform == 'macos-latest'
uses: actions/cache@v4
with:
path: |
~/Library/Caches/Homebrew
/usr/local/Cellar/ffmpeg
/usr/local/Cellar/pkg-config
key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/release-cli.yml') }}
restore-keys: |
${{ runner.os }}-brew-
- name: Cache Pre Build
id: cache-pre-build
uses: actions/cache@v4
with:
path: |
screenpipe-app-tauri/src-tauri/ffmpeg
screenpipe-app-tauri/src-tauri/tesseract-*
screenpipe-app-tauri/node_modules
screenpipe-app-tauri/src-tauri/target
screenpipe-app-tauri/.tauri
screenpipe-app-tauri/src-tauri/WixTools
screenpipe-app-tauri/src-tauri/mkl
# Ollama binaries and libs
screenpipe-app-tauri/src-tauri/ollama-*
screenpipe-app-tauri/src-tauri/lib/ollama
# Swift UI monitoring binaries
screenpipe-app-tauri/src-tauri/ui_monitor-*
# FFmpeg downloads
screenpipe-app-tauri/src-tauri/ffmpeg-*
# Platform specific bins
screenpipe-app-tauri/src-tauri/bun-*
screenpipe-app-tauri/src-tauri/screenpipe-*
key: ${{ matrix.platform }}-${{ matrix.target }}-pre-build-${{ hashFiles('**/Cargo.lock', '**/bun.lockb') }}
restore-keys: |
${{ matrix.platform }}-${{ matrix.target }}-pre-build-
- name: Install dependencies
if: matrix.platform == 'macos-latest'
shell: bash
run: |
brew install ffmpeg
- name: Install frontend dependencies
working-directory: ./screenpipe-app-tauri
run: bun install
- name: Install vcpkg
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3"
- name: Set up MSVC
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Install 7zip
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
run: |
$7zipUrl = "https://7-zip.org/a/7z2301-x64.exe"
$7zipInstaller = "7z-installer.exe"
Invoke-WebRequest -Uri $7zipUrl -OutFile $7zipInstaller
Start-Process -FilePath .\$7zipInstaller -Args "/S" -Wait
Remove-Item $7zipInstaller
# Add 7zip to PATH and make it persistent for subsequent steps
echo "C:\Program Files\7-Zip" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Verify installation
& "C:\Program Files\7-Zip\7z.exe" i
- name: Cache LLVM
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
id: cache-llvm
uses: actions/cache@v4
with:
path: |
C:\Program Files\LLVM
${{ runner.temp }}\llvm
key: llvm-10.0-windows-${{ hashFiles('.github/workflows/release-app.yml') }}
- name: Install LLVM and Clang
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc' && steps.cache-llvm.outputs.cache-hit != 'true'
shell: powershell
run: |
# Create LLVM directory with proper permissions
$llvmPath = "C:\Program Files\LLVM"
if (!(Test-Path $llvmPath)) {
New-Item -ItemType Directory -Force -Path $llvmPath | Out-Null
$acl = Get-Acl $llvmPath
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Users","FullControl","Allow")
$acl.SetAccessRule($rule)
Set-Acl $llvmPath $acl
}
# Download and install LLVM
$installerUrl = "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe"
$installerPath = Join-Path $env:TEMP "LLVM-10.0.0-win64.exe"
Write-Host "Downloading LLVM installer..."
Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath
Write-Host "Installing LLVM..."
Start-Process -FilePath $installerPath -ArgumentList "/S","/D=$llvmPath" -Wait -NoNewWindow
Remove-Item $installerPath -Force
# Verify installation
if (!(Test-Path "$llvmPath\bin\clang.exe")) {
throw "LLVM installation failed - clang.exe not found"
}
Write-Host "LLVM installation completed successfully"
- name: Install wget on Windows
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
env:
SKIP_SCREENPIPE_SETUP: true
run: |
# Remove wget alias if it exists
if (Test-Path Alias:wget) {
Remove-Item Alias:wget -Force
}
# Create wget directory
$wgetDir = "C:\wget"
New-Item -ItemType Directory -Force -Path $wgetDir
# Download wget executable
$wgetUrl = "https://eternallybored.org/misc/wget/releases/wget-1.21.4-win64.zip"
$wgetZip = "$wgetDir\wget.zip"
# Use Invoke-WebRequest to download
Invoke-WebRequest -Uri $wgetUrl -OutFile $wgetZip
# Extract wget
Expand-Archive -Path $wgetZip -DestinationPath $wgetDir -Force
Remove-Item $wgetZip
# Add to PATH for current session only
$env:Path = "$wgetDir;$env:Path"
# Verify installation
& "$wgetDir\wget.exe" --version
- name: Run pre_build.js
env:
SKIP_SCREENPIPE_SETUP: true
run: bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./screenpipe-app-tauri
- name: Build CLI
if: matrix.tauri-args != '--target x86_64-pc-windows-msvc'
shell: bash
run: |
if [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_ALLOW_CROSS=1
fi
cargo build --release -p screenpipe-server ${{ matrix.args }}
- name: Build CLI on Windows
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
env:
CARGO_PROFILE_RELEASE_STRIP: symbols
CARGO_PROFILE_RELEASE_PANIC: abort
CARGO_PROFILE_RELEASE_INCREMENTAL: false
run: cargo build --release -p screenpipe-server ${{ matrix.args }}
# Run pre build again to copy the CLI into app
- name: Run pre_build.js
run: |
bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./screenpipe-app-tauri
- uses: actions/setup-python@v5
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
with:
python-version: '3.13'
- name: Copy library for MKL
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
run: |
# Create target directory
$mkl_dir = "screenpipe-app-tauri/src-tauri/mkl"
New-Item -ItemType Directory -Force -Path $mkl_dir | Out-Null
# Install and copy Intel OpenMP
python -m pip install --upgrade pip
$temp_dir = "temp_omp"
New-Item -ItemType Directory -Force -Path $temp_dir | Out-Null
Write-Host "Installing Intel OpenMP..."
python -m pip install intel-openmp --target $temp_dir
Write-Host "Copying DLL files..."
Get-ChildItem -Path $temp_dir -Recurse -Filter "*.dll" | ForEach-Object {
Write-Host "Copying $_"
Copy-Item $_.FullName -Destination $mkl_dir -Force
}
# Verify DLLs were copied
$dll_count = (Get-ChildItem -Path $mkl_dir -Filter "*.dll").Count
Write-Host "Found $dll_count DLLs in target directory"
if ($dll_count -eq 0) {
throw "No DLLs found in target directory!"
}
Remove-Item -Path $temp_dir -Recurse -Force
- name: Build
uses: tauri-apps/[email protected]
env:
# for updater
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# for release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for macos signing
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# https://tauri.app/v1/guides/distribution/sign-macos
CI: true
# Optimize for build speed on Windows
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'thin' || 'false' }}
CARGO_PROFILE_RELEASE_OPT_LEVEL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '2' || '3' }}
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '16' || '16' }}
# Enable incremental compilation for Windows
CARGO_INCREMENTAL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'true' || 'false' }}
# Windows specific optimizations (only applied when building for Windows)
CARGO_PROFILE_RELEASE_STRIP: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'symbols' || 'none' }}
CARGO_PROFILE_RELEASE_PANIC: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'abort' || 'unwind' }}
CARGO_PROFILE_RELEASE_INCREMENTAL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'false' || 'true' }}
RUSTFLAGS: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '-C target-feature=+crt-static -C link-arg=/LTCG' || '' }}
VCPKG_STATIC_LINKAGE: "true"
KNF_STATIC_CRT: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '1' || '' }}
with:
args: ${{ matrix.tauri-args }}
projectPath: "./screenpipe-app-tauri"
tauriScript: bunx tauri -vvv
retryAttempts: 3
- name: Download and Run CLI Manually (Windows)
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
env:
CN_API_KEY: ${{ secrets.CN_API_KEY }}
CN_VERBOSE: "2"
USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
MAX_RETRIES: 5
RETRY_DELAY: 30
run: |
# create temp directory for cli
$cliDir = Join-Path $Env:GITHUB_WORKSPACE "cn-cli-temp"
New-Item -ItemType Directory -Force -Path $cliDir
# download cli
$cliUrl = "https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/windows-binary-x86_64"
$cliExe = Join-Path $cliDir "cn.exe"
Write-Host "downloading crabnebula cli..."
Invoke-WebRequest -Uri $cliUrl -UserAgent $env:USER_AGENT -OutFile $cliExe
# move to the directory we want to upload from
cd screenpipe-app-tauri/src-tauri
# upload assets with retry logic
$cliFullPath = Join-Path $cliDir "cn.exe"
Write-Host "uploading assets from $(pwd) using $cliFullPath..."
$attempt = 1
$success = $false
while (-not $success -and $attempt -le $env:MAX_RETRIES) {
Write-Host "Attempt $attempt of $env:MAX_RETRIES"
try {
& $cliFullPath release upload ${{ secrets.CN_APP_SLUG }} --framework tauri -vv
if ($LASTEXITCODE -eq 0) {
$success = $true
Write-Host "Upload successful!"
} else {
throw "CLI returned exit code $LASTEXITCODE"
}
} catch {
Write-Host "Error during attempt $attempt`: $_"
if ($attempt -lt $env:MAX_RETRIES) {
Write-Host "Waiting $env:RETRY_DELAY seconds before retry..."
Start-Sleep -Seconds $env:RETRY_DELAY
}
}
$attempt++
}
if (-not $success) {
Write-Host "Failed to upload after $env:MAX_RETRIES attempts"
exit 1
}
- name: Upload Assets to CrabNebula Cloud (Non-Windows)
if: matrix.tauri-args != '--target x86_64-pc-windows-msvc'
uses: crabnebula-dev/[email protected]
env:
CN_VERBOSE: "2"
with:
command: release upload ${{ secrets.CN_APP_SLUG }} --framework tauri -vv
api-key: ${{ secrets.CN_API_KEY }}
path: ./screenpipe-app-tauri/src-tauri
retry-win:
needs: publish-tauri
if: ${{ always() && contains(needs.publish-tauri.result, 'failure') }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest # Windows x86_64
args: "--target x86_64-pc-windows-msvc --features mkl" # TODO CUDA --features "openblas"
pre-build-args: "" # --openblas
tauri-args: "--target x86_64-pc-windows-msvc"
shell: pwsh
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_hash || github.ref }}
- name: Update version in Cargo.toml
if: github.event.inputs.commit_hash && github.event.inputs.version && matrix.platform != 'macos-latest'
shell: pwsh
run: |
$content = Get-Content screenpipe-app-tauri/src-tauri/Cargo.toml
$content = $content -replace '^version = ".*"', ('version = "' + '${{ github.event.inputs.version }}' + '"')
$content | Set-Content screenpipe-app-tauri/src-tauri/Cargo.toml -Force
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.43
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
run: |
Invoke-WebRequest https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile rustup-init.exe
.\rustup-init.exe -y
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/${{ matrix.target }}/release/deps
target/${{ matrix.target }}/release/build
key: ${{ matrix.platform }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-v1-
- name: Cache Pre Build
id: cache-pre-build
uses: actions/cache@v4
with:
path: |
screenpipe-app-tauri/src-tauri/ffmpeg
screenpipe-app-tauri/src-tauri/tesseract-*
screenpipe-app-tauri/node_modules
screenpipe-app-tauri/src-tauri/target
screenpipe-app-tauri/.tauri
screenpipe-app-tauri/src-tauri/WixTools
screenpipe-app-tauri/src-tauri/mkl
# Ollama binaries and libs
screenpipe-app-tauri/src-tauri/ollama-*
screenpipe-app-tauri/src-tauri/lib/ollama
# Swift UI monitoring binaries
screenpipe-app-tauri/src-tauri/ui_monitor-*
# FFmpeg downloads
screenpipe-app-tauri/src-tauri/ffmpeg-*
# Platform specific bins
screenpipe-app-tauri/src-tauri/bun-*
screenpipe-app-tauri/src-tauri/screenpipe-*
key: ${{ matrix.platform }}-${{ matrix.target }}-pre-build-${{ hashFiles('**/Cargo.lock', '**/bun.lockb') }}
restore-keys: |
${{ matrix.platform }}-${{ matrix.target }}-pre-build-
- name: Install frontend dependencies
working-directory: ./screenpipe-app-tauri
run: bun install
- name: Install vcpkg
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3"
- name: Set up MSVC
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Install 7zip
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: powershell
run: |
$7zipUrl = "https://7-zip.org/a/7z2301-x64.exe"
$7zipInstaller = "7z-installer.exe"
Invoke-WebRequest -Uri $7zipUrl -OutFile $7zipInstaller
Start-Process -FilePath .\$7zipInstaller -Args "/S" -Wait
Remove-Item $7zipInstaller
# Add 7zip to PATH and make it persistent for subsequent steps
echo "C:\Program Files\7-Zip" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Verify installation
& "C:\Program Files\7-Zip\7z.exe" i
- name: Cache LLVM
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
id: cache-llvm
uses: actions/cache@v4
with:
path: |
C:\Program Files\LLVM
${{ runner.temp }}\llvm
key: llvm-10.0-windows-${{ hashFiles('.github/workflows/release-app.yml') }}
- name: Install LLVM and Clang
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc' && steps.cache-llvm.outputs.cache-hit != 'true'
uses: KyleMayes/install-llvm-action@v2
with:
version: "10.0"
directory: "C:\\Program Files\\LLVM"
- name: Run pre_build.js
env:
SKIP_SCREENPIPE_SETUP: true
run: bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./screenpipe-app-tauri
- name: Build CLI on Windows
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: pwsh
env:
CARGO_PROFILE_RELEASE_STRIP: symbols
CARGO_PROFILE_RELEASE_PANIC: abort
CARGO_PROFILE_RELEASE_INCREMENTAL: false
run: cargo build --release -p screenpipe-server ${{ matrix.args }}
# Run pre build again to copy the CLI into app
- name: Run pre_build.js
run: |
bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./screenpipe-app-tauri
- name: Install pip
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Copy library for MKL
if: matrix.tauri-args == '--target x86_64-pc-windows-msvc'
shell: pwsh
run: |
# Install pip first
Invoke-WebRequest -Uri https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py
python get-pip.py
# Continue with existing steps
mkdir omp
pip install intel-openmp --target omp
# Create mkl directory if it doesn't exist (ignore error if it does)
mkdir screenpipe-app-tauri/src-tauri/mkl/ -ErrorAction SilentlyContinue
ls -Path ./omp -Recurse -Filter *.dll | cp -Destination screenpipe-app-tauri/src-tauri/mkl/
- name: Build
uses: tauri-apps/[email protected]
env:
# for updater
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# for release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for macos signing
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# https://tauri.app/v1/guides/distribution/sign-macos
CI: true
# Optimize for build speed on Windows
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'thin' || 'false' }}
CARGO_PROFILE_RELEASE_OPT_LEVEL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '2' || '3' }}
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '16' || '16' }}
# Enable incremental compilation for Windows
CARGO_INCREMENTAL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'true' || 'false' }}
# Windows specific optimizations (only applied when building for Windows)
CARGO_PROFILE_RELEASE_STRIP: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'symbols' || 'none' }}
CARGO_PROFILE_RELEASE_PANIC: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'abort' || 'unwind' }}
CARGO_PROFILE_RELEASE_INCREMENTAL: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && 'false' || 'true' }}
RUSTFLAGS: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '-C target-feature=+crt-static -C link-arg=/LTCG' || '' }}
VCPKG_STATIC_LINKAGE: "true"
KNF_STATIC_CRT: ${{ matrix.tauri-args == '--target x86_64-pc-windows-msvc' && '1' || '' }}
with:
args: ${{ matrix.tauri-args }}
projectPath: "./screenpipe-app-tauri"
tauriScript: bunx tauri -v
- name: Upload Assets to CrabNebula Cloud
uses: crabnebula-dev/[email protected]
with:
command: release upload ${{ secrets.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./screenpipe-app-tauri/src-tauri
publish-release:
needs: [check_commit, publish-tauri, retry-win]
if: needs.check_commit.outputs.should_publish == 'true' && (needs.publish-tauri.result == 'success' || needs.retry-win.result == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version from Cargo.toml
id: get_version
run: |
VERSION=$(grep '^version = ' screenpipe-app-tauri/src-tauri/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish Release on CrabNebula Cloud
uses: crabnebula-dev/[email protected]
with:
command: release publish ${{ secrets.CN_APP_SLUG }} ${{ env.VERSION }}
api-key: ${{ secrets.CN_API_KEY }}