Files
aryx/scripts/publish-sidecar.ts
T
David KayaandCopilot 2f069f60b4 feat: add cross-platform release automation
Add a GitHub Actions workflow that validates the app on pushes and pull requests, and publishes Windows, macOS, and Linux release assets when a tag is pushed.

Also replace the Windows-only packaging flow with cross-platform Bun scripts for sidecar publishing and Electron packaging so the release job can package each runner natively.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 19:20:46 +01:00

66 lines
1.7 KiB
TypeScript

import { spawn } from 'node:child_process';
import { rm } from 'node:fs/promises';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { resolveReleaseTarget } from './releaseTarget';
function runCommand(command: string, args: string[], cwd: string): Promise<void> {
return new Promise((resolvePromise, rejectPromise) => {
const child = spawn(command, args, {
cwd,
stdio: 'inherit',
});
child.on('error', rejectPromise);
child.on('exit', (code, signal) => {
if (code === 0) {
resolvePromise();
return;
}
if (signal) {
rejectPromise(new Error(`${command} exited because of signal ${signal}.`));
return;
}
rejectPromise(new Error(`${command} exited with code ${code ?? 'unknown'}.`));
});
});
}
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
const repositoryRoot = resolve(scriptDirectory, '..');
const releaseTarget = resolveReleaseTarget(process.platform, process.arch);
const sidecarProjectPath = join(
repositoryRoot,
'sidecar',
'src',
'Eryx.AgentHost',
'Eryx.AgentHost.csproj',
);
const outputDirectory = join(repositoryRoot, 'dist-sidecar', releaseTarget.dotnetRuntime);
await rm(outputDirectory, { recursive: true, force: true });
await runCommand(
'dotnet',
[
'publish',
sidecarProjectPath,
'-c',
'Release',
'-r',
releaseTarget.dotnetRuntime,
'--self-contained',
'true',
'-p:DebugType=None',
'-p:DebugSymbols=false',
'-o',
outputDirectory,
],
repositoryRoot,
);
console.log(`Published sidecar for ${releaseTarget.platformLabel} (${releaseTarget.dotnetRuntime}) to ${outputDirectory}`);