authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-05-06 13:55:37-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-05-06 13:55:37-07:00
log6c79039ce752c4bc6e2f6bcac929a543e9544774
tree37452c988116f7822611b1deff908cd13f2fd121
parent449e1aaa48061eb282bcaf3fc2d2280bc671c6c5
signature Signed by PGP key B5690EEEBB952194

Cache desktop build assets in CI and release workflows (#2543)

Co-authored-by: Julius Marminge <julius@macmini.local> Co-authored-by: Cursor Agent <cursoragent@cursor.com>

2 files changed, 102 insertions(+), 18 deletions(-)

.github/workflows/ci.yml+22-4
...@@ -25,8 +25,9 @@ jobs:...@@ -25,8 +25,9 @@ jobs:
25 with:25 with:
26 node-version-file: package.json26 node-version-file: package.json
2727
28 - name: Cache Bun and Turbo28 - id: bun_turbo_cache
29 uses: actions/cache@v529 name: Restore Bun and Turbo cache
30 uses: actions/cache/restore@v5
30 with:31 with:
31 path: |32 path: |
32 ~/.bun/install/cache33 ~/.bun/install/cache
...@@ -35,8 +36,9 @@ jobs:...@@ -35,8 +36,9 @@ jobs:
35 restore-keys: |36 restore-keys: |
36 ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-37 ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
3738
38 - name: Cache Playwright browsers39 - id: playwright_cache
39 uses: actions/cache@v540 name: Restore Playwright browsers
41 uses: actions/cache/restore@v5
40 with:42 with:
41 path: ~/.cache/ms-playwright43 path: ~/.cache/ms-playwright
42 key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}44 key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}
...@@ -69,6 +71,22 @@ jobs:...@@ -69,6 +71,22 @@ jobs:
69 - name: Build desktop pipeline71 - name: Build desktop pipeline
70 run: bun run build:desktop72 run: bun run build:desktop
7173
74 - name: Save Playwright browsers
75 if: steps.playwright_cache.outputs.cache-hit != 'true'
76 uses: actions/cache/save@v5
77 with:
78 path: ~/.cache/ms-playwright
79 key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}
80
81 - name: Save Bun and Turbo cache
82 if: steps.bun_turbo_cache.outputs.cache-hit != 'true'
83 uses: actions/cache/save@v5
84 with:
85 path: |
86 ~/.bun/install/cache
87 .turbo
88 key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-${{ hashFiles('turbo.json') }}
89
72 - name: Verify preload bundle output90 - name: Verify preload bundle output
73 run: |91 run: |
74 test -f apps/desktop/dist-electron/preload.cjs92 test -f apps/desktop/dist-electron/preload.cjs
.github/workflows/release.yml+80-14
...@@ -311,7 +311,9 @@ jobs:...@@ -311,7 +311,9 @@ jobs:
311 shell: bash311 shell: bash
312 run: |312 run: |
313 set -euo pipefail313 set -euo pipefail
314 mkdir -p release-publish314 asset_dir="release-artifacts/desktop-${{ matrix.platform }}-${{ matrix.arch }}"
315 rm -rf "$asset_dir"
316 mkdir -p "$asset_dir"
315317
316 shopt -s nullglob318 shopt -s nullglob
317 for pattern in \319 for pattern in \
...@@ -322,13 +324,13 @@ jobs:...@@ -322,13 +324,13 @@ jobs:
322 "release/*.blockmap" \324 "release/*.blockmap" \
323 "release/*.yml"; do325 "release/*.yml"; do
324 for file in $pattern; do326 for file in $pattern; do
325 cp "$file" release-publish/327 cp "$file" "$asset_dir"/
326 done328 done
327 done329 done
328330
329 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then331 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
330 shopt -s nullglob332 shopt -s nullglob
331 for manifest in release-publish/*-mac.yml; do333 for manifest in "$asset_dir"/*-mac.yml; do
332 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"334 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"
333 done335 done
334 fi336 fi
...@@ -340,17 +342,23 @@ jobs:...@@ -340,17 +342,23 @@ jobs:
340 # canonical manifest per channel.342 # canonical manifest per channel.
341 # if [[ "${{ matrix.platform }}" == "win" ]]; then343 # if [[ "${{ matrix.platform }}" == "win" ]]; then
342 # shopt -s nullglob344 # shopt -s nullglob
343 # for manifest in release-publish/*.yml; do345 # for manifest in "$asset_dir"/*.yml; do
344 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"346 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
345 # done347 # done
346 # fi348 # fi
347349
348 - name: Upload build artifacts350 assets=("$asset_dir"/*)
349 uses: actions/upload-artifact@v7351 if (( ${#assets[@]} == 0 )); then
352 echo "No release assets were collected for ${{ matrix.platform }} ${{ matrix.arch }}." >&2
353 exit 1
354 fi
355
356 - name: Save build artifacts
357 uses: actions/cache/save@v5
350 with:358 with:
351 name: desktop-${{ matrix.platform }}-${{ matrix.arch }}359 path: release-artifacts/desktop-${{ matrix.platform }}-${{ matrix.arch }}
352 path: release-publish/*360 key: release-assets-${{ github.run_id }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.run_attempt }}
353 if-no-files-found: error361 enableCrossOsArchive: true
354362
355 publish_cli:363 publish_cli:
356 name: Publish CLI to npm364 name: Publish CLI to npm
...@@ -423,12 +431,70 @@ jobs:...@@ -423,12 +431,70 @@ jobs:
423 - name: Install dependencies431 - name: Install dependencies
424 run: bun install --frozen-lockfile --filter=@t3tools/scripts432 run: bun install --frozen-lockfile --filter=@t3tools/scripts
425433
426 - name: Download all desktop artifacts434 # Keep these restore steps in sync with the desktop build matrix.
427 uses: actions/download-artifact@v8435 # Cache restore cannot enumerate a key pattern like download-artifact did.
436 - name: Restore macOS arm64 desktop assets
437 uses: actions/cache/restore@v5
438 with:
439 path: release-artifacts/desktop-mac-arm64
440 key: release-assets-${{ github.run_id }}-mac-arm64-${{ github.run_attempt }}
441 restore-keys: |
442 release-assets-${{ github.run_id }}-mac-arm64-
443 fail-on-cache-miss: true
444 enableCrossOsArchive: true
445
446 - name: Restore macOS x64 desktop assets
447 uses: actions/cache/restore@v5
448 with:
449 path: release-artifacts/desktop-mac-x64
450 key: release-assets-${{ github.run_id }}-mac-x64-${{ github.run_attempt }}
451 restore-keys: |
452 release-assets-${{ github.run_id }}-mac-x64-
453 fail-on-cache-miss: true
454 enableCrossOsArchive: true
455
456 - name: Restore Linux x64 desktop assets
457 uses: actions/cache/restore@v5
428 with:458 with:
429 pattern: desktop-*459 path: release-artifacts/desktop-linux-x64
430 merge-multiple: true460 key: release-assets-${{ github.run_id }}-linux-x64-${{ github.run_attempt }}
431 path: release-assets461 restore-keys: |
462 release-assets-${{ github.run_id }}-linux-x64-
463 fail-on-cache-miss: true
464 enableCrossOsArchive: true
465
466 - name: Restore Windows x64 desktop assets
467 uses: actions/cache/restore@v5
468 with:
469 path: release-artifacts/desktop-win-x64
470 key: release-assets-${{ github.run_id }}-win-x64-${{ github.run_attempt }}
471 restore-keys: |
472 release-assets-${{ github.run_id }}-win-x64-
473 fail-on-cache-miss: true
474 enableCrossOsArchive: true
475
476 - name: Stage desktop assets
477 shell: bash
478 run: |
479 set -euo pipefail
480 rm -rf release-assets
481 mkdir -p release-assets
482
483 shopt -s nullglob
484 for dir in release-artifacts/desktop-*; do
485 files=("$dir"/*)
486 if (( ${#files[@]} == 0 )); then
487 echo "No release assets were restored from $dir." >&2
488 exit 1
489 fi
490 cp "${files[@]}" release-assets/
491 done
492
493 assets=(release-assets/*)
494 if (( ${#assets[@]} == 0 )); then
495 echo "No desktop release assets were staged." >&2
496 exit 1
497 fi
432498
433 - name: Merge macOS updater manifests499 - name: Merge macOS updater manifests
434 run: |500 run: |