File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 - name : Install deps
5050 run : bun install --frozen-lockfile
5151
52+ - name : Install rcodesign (for ad-hoc darwin signing)
53+ if : startsWith(matrix.bun-target, 'bun-darwin-') && runner.os != 'macOS'
54+ shell : bash
55+ env :
56+ RCODESIGN_VERSION : " 0.29.0"
57+ run : |
58+ set -e
59+ url="https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F${RCODESIGN_VERSION}/apple-codesign-${RCODESIGN_VERSION}-x86_64-unknown-linux-musl.tar.gz"
60+ curl -fsSL "$url" | tar -xz
61+ sudo mv "apple-codesign-${RCODESIGN_VERSION}-x86_64-unknown-linux-musl/rcodesign" /usr/local/bin/rcodesign
62+ rcodesign --version
63+
5264 - name : Build binary
5365 shell : bash
5466 env :
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ async function sha256(file: string): Promise<string> {
3434 return hash . digest ( "hex" ) ;
3535}
3636
37+ async function adhocSignDarwin ( binPath : string ) : Promise < void > {
38+ if ( process . platform === "darwin" ) {
39+ await $ `codesign --sign - --force ${ binPath } ` . quiet ( ) ;
40+ return ;
41+ }
42+ try {
43+ await $ `rcodesign sign ${ binPath } ` . quiet ( ) ;
44+ } catch {
45+ throw new Error (
46+ "rcodesign is required to ad-hoc sign darwin binaries from non-macOS hosts. " +
47+ "Install: https://github.com/indygreg/apple-platform-rs/releases (look for apple-codesign)." ,
48+ ) ;
49+ }
50+ }
51+
3752async function tarGz ( binPath : string , archivePath : string , binName : string ) : Promise < void > {
3853 const cwd = resolve ( binPath , ".." ) ;
3954 await $ `tar -czf ${ archivePath } -C ${ cwd } ${ binName } ` ;
@@ -57,6 +72,10 @@ async function buildOne(target: Target): Promise<{ archive: string; sha256: stri
5772 console . log ( `→ ${ target . bunTarget } ` ) ;
5873 await $ `bun build ${ ENTRY } --compile --minify --target=${ target . bunTarget } --outfile=${ binPath } ` . quiet ( ) ;
5974
75+ if ( target . bunTarget . startsWith ( "bun-darwin-" ) ) {
76+ await adhocSignDarwin ( binPath ) ;
77+ }
78+
6079 const archiveName = target . archive === "tar.gz"
6180 ? `quoteforge-${ target . triple } .tar.gz`
6281 : `quoteforge-${ target . triple } .zip` ;
You can’t perform that action at this time.
0 commit comments