Skip to content

Commit 89353f8

Browse files
committed
fix(ci): include bootstrap deps in SEA binary cache key
Same cache key mismatch issue as smol binary - SEA bundles CLI which uses bootstrap-npm.js, but cache key only included SEA builder and CLI source, not bootstrap/socket dependencies. Flow before: 1. build-deps: Creates cache key from bootstrap/socket/CLI source 2. build-sea: Creates DIFFERENT cache key from only SEA builder/CLI src 3. When bootstrap changes: New bootstrap built, but old SEA reused 4. Result: Stale bootstrap bundled in SEA binary Fix: - Added deps-hash output from build-deps job - Combined SEA hash with deps-hash in cache key - Now ANY bootstrap/socket/CLI change invalidates SEA binary cache This prevents runtime errors from stale bootstrap code in SEA binaries.
1 parent f383f60 commit 89353f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/build-sea.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
name: 📦 Build Dependencies
3131
runs-on: ubuntu-latest
3232
timeout-minutes: 30
33+
outputs:
34+
deps-hash: ${{ steps.deps-cache-key.outputs.hash }}
3335
steps:
3436
- name: Checkout
3537
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -352,8 +354,10 @@ jobs:
352354
id: sea-cache-key
353355
shell: bash
354356
run: |
355-
HASH=$(find packages/node-sea-builder packages/cli/src -type f \( -name "*.mts" -o -name "*.ts" -o -name "*.mjs" -o -name "*.js" \) | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)
356-
echo "hash=$HASH" >> $GITHUB_OUTPUT
357+
SEA_HASH=$(find packages/node-sea-builder packages/cli/src -type f \( -name "*.mts" -o -name "*.ts" -o -name "*.mjs" -o -name "*.js" \) | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)
358+
# Include bootstrap/socket/cli dependencies in cache key to invalidate when they change.
359+
COMBINED_HASH=$(echo "$SEA_HASH-${{ needs.build-deps.outputs.deps-hash }}" | sha256sum | cut -d' ' -f1)
360+
echo "hash=$COMBINED_HASH" >> $GITHUB_OUTPUT
357361
358362
- name: Restore SEA binary cache
359363
if: inputs.force != true

0 commit comments

Comments
 (0)