44 workflow_dispatch :
55 inputs :
66 version :
7- description : " Version to publish (e.g. 0.1 .0-rc.2 )"
7+ description : " Version to publish (e.g. 0.2 .0-rc.1 )"
88 required : true
99 type : string
1010 npm-tag :
@@ -20,7 +20,88 @@ concurrency:
2020 cancel-in-progress : false
2121
2222jobs :
23+ # Build V8 sidecar binaries for all platforms
24+ build-v8 :
25+ name : " Build V8 (${{ matrix.npm-dir }})"
26+ strategy :
27+ fail-fast : false
28+ matrix :
29+ include :
30+ - target : x86_64-unknown-linux-gnu
31+ os : ubuntu-latest
32+ npm-dir : linux-x64-gnu
33+ binary : secure-exec-v8
34+ - target : aarch64-unknown-linux-gnu
35+ os : ubuntu-latest
36+ npm-dir : linux-arm64-gnu
37+ binary : secure-exec-v8
38+ cross : true
39+ - target : x86_64-apple-darwin
40+ os : macos-13
41+ npm-dir : darwin-x64
42+ binary : secure-exec-v8
43+ - target : aarch64-apple-darwin
44+ os : macos-latest
45+ npm-dir : darwin-arm64
46+ binary : secure-exec-v8
47+ - target : x86_64-pc-windows-msvc
48+ os : windows-latest
49+ npm-dir : win32-x64
50+ binary : secure-exec-v8.exe
51+ runs-on : ${{ matrix.os }}
52+ steps :
53+ - name : Checkout tag
54+ uses : actions/checkout@v4
55+ with :
56+ ref : v${{ inputs.version }}
57+
58+ - name : Set up Rust toolchain
59+ uses : dtolnay/rust-toolchain@stable
60+ with :
61+ toolchain : " 1.85.0"
62+ targets : ${{ matrix.target }}
63+
64+ - name : Cache Rust build artifacts
65+ uses : actions/cache@v4
66+ with :
67+ path : |
68+ ~/.cargo/registry
69+ ~/.cargo/git
70+ native/v8-runtime/target
71+ key : rust-release-${{ matrix.target }}-${{ hashFiles('native/v8-runtime/Cargo.lock') }}
72+ restore-keys : |
73+ rust-release-${{ matrix.target }}-
74+
75+ - name : Install cross-compilation tools
76+ if : matrix.cross
77+ run : |
78+ sudo apt-get update
79+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
80+
81+ - name : Configure cross-compilation linker
82+ if : matrix.cross
83+ working-directory : native/v8-runtime
84+ run : |
85+ mkdir -p .cargo
86+ cat > .cargo/config.toml <<'EOF'
87+ [target.aarch64-unknown-linux-gnu]
88+ linker = "aarch64-linux-gnu-gcc"
89+ EOF
90+
91+ - name : Build
92+ working-directory : native/v8-runtime
93+ run : cargo build --release --target ${{ matrix.target }}
94+
95+ - name : Upload binary artifact
96+ uses : actions/upload-artifact@v4
97+ with :
98+ name : v8-${{ matrix.npm-dir }}
99+ path : native/v8-runtime/target/${{ matrix.target }}/release/${{ matrix.binary }}
100+
101+ # Publish all packages to npm after V8 binaries are built
23102 publish :
103+ name : " Publish"
104+ needs : [build-v8]
24105 runs-on : ubuntu-latest
25106 permissions :
26107 contents : write
@@ -52,10 +133,38 @@ jobs:
52133 - name : Build
53134 run : pnpm turbo build
54135
55- - name : Build linux-x64 binary via Docker
136+ # Download all V8 platform binaries into their npm package dirs
137+ - name : Download V8 binaries
138+ uses : actions/download-artifact@v4
139+ with :
140+ pattern : v8-*
141+ path : native/v8-runtime/npm
142+
143+ - name : Place V8 binaries
56144 run : |
57- cd native/v8-runtime
58- docker build -f docker/Dockerfile.linux-x64-gnu -o type=local,dest=npm/linux-x64-gnu .
145+ for dir in native/v8-runtime/npm/v8-*/; do
146+ PLATFORM_DIR=$(basename "$dir" | sed 's/^v8-//')
147+ TARGET_DIR="native/v8-runtime/npm/${PLATFORM_DIR}"
148+ if [ -d "$TARGET_DIR" ]; then
149+ cp "$dir"/* "$TARGET_DIR/"
150+ # Make binary executable on Unix platforms
151+ find "$TARGET_DIR" -name "secure-exec-v8" -exec chmod +x {} \;
152+ echo "✓ Placed binary in ${TARGET_DIR}"
153+ fi
154+ done
155+ # Verify all platform packages have their binary
156+ echo "--- Binary verification ---"
157+ for dir in native/v8-runtime/npm/*/; do
158+ PLATFORM=$(basename "$dir")
159+ # Skip artifact staging dirs
160+ if [[ "$PLATFORM" == v8-* ]]; then continue; fi
161+ if ls "$dir"secure-exec-v8* 1>/dev/null 2>&1; then
162+ echo "✓ ${PLATFORM}: $(ls "$dir"secure-exec-v8*)"
163+ else
164+ echo "✗ ${PLATFORM}: MISSING BINARY"
165+ exit 1
166+ fi
167+ done
59168
60169 - name : Publish to npm
61170 run : |
84193 if [ ! -f "$dir/package.json" ]; then
85194 continue
86195 fi
196+ # Skip artifact staging dirs
197+ PLATFORM=$(basename "$dir")
198+ if [[ "$PLATFORM" == v8-* ]]; then continue; fi
87199 NAME=$(jq -r .name "$dir/package.json")
88200 VERSION="${{ inputs.version }}"
89201 if npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then
0 commit comments