Fix the release build: skip windows metadata when cross-compiling
`bun build --compile --target=bun-windows-x64` rejects `--windows-title` unless
the host is Windows:
error: Using --windows-title is only available when compiling on Windows
build failed for windows-x64 (exit 1)
CI releases all five targets from one Ubuntu runner, so the flag failed the
release on the last of the five builds — after the other four had already been
produced. Locally on Windows it passed, which is why it shipped.
The metadata is now stamped only on a Windows host. The published binary goes
without it rather than the release failing.
Extracted `buildArgs()` so the host-dependent branch is testable: the previous
version could only be checked by running a five-platform build on two operating
systems.
This commit is contained in:
+21
-10
@@ -20,6 +20,26 @@ export const TARGETS: Target[] = [
|
||||
|
||||
const OUT = 'dist/release';
|
||||
|
||||
/**
|
||||
* Build arguments for one target.
|
||||
*
|
||||
* Executable metadata can only be stamped by a Windows host: bun rejects
|
||||
* `--windows-title` when cross-compiling, and CI releases every target from one
|
||||
* Ubuntu runner. The published binary goes without it rather than the release
|
||||
* failing on the last of five builds.
|
||||
*/
|
||||
export function buildArgs(t: Target, outfile: string, host = process.platform): string[] {
|
||||
const args = ['build', '--compile', '--minify', `--target=${t.target}`, 'src/cli.tsx', '--outfile', outfile];
|
||||
if (t.windows && host === 'win32') {
|
||||
args.push(
|
||||
'--windows-title=shiro-neko',
|
||||
'--windows-description=Agentic coding CLI',
|
||||
`--windows-version=${VERSION.split('-')[0]}.0`,
|
||||
);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds one executable per platform.
|
||||
*
|
||||
@@ -58,16 +78,7 @@ async function main(): Promise<void> {
|
||||
const base = `shiro-${t.name}`;
|
||||
const outfile = join(OUT, base);
|
||||
|
||||
const buildArgs = ['build', '--compile', '--minify', `--target=${t.target}`, 'src/cli.tsx', '--outfile', outfile];
|
||||
if (t.windows) {
|
||||
buildArgs.push(
|
||||
'--windows-title=shiro-neko',
|
||||
'--windows-description=Agentic coding CLI',
|
||||
`--windows-version=${VERSION.split('-')[0]}.0`,
|
||||
);
|
||||
}
|
||||
|
||||
const proc = Bun.spawn(['bun', ...buildArgs], { stdout: 'inherit', stderr: 'inherit' });
|
||||
const proc = Bun.spawn(['bun', ...buildArgs(t, outfile)], { stdout: 'inherit', stderr: 'inherit' });
|
||||
const code = await proc.exited;
|
||||
if (code !== 0) {
|
||||
console.error(`\nbuild failed for ${t.name} (exit ${code})`);
|
||||
|
||||
Reference in New Issue
Block a user