chore: publish CentOS7 single executable package

This commit is contained in:
shiyue
2026-06-24 11:13:55 +08:00
parent ca97d92a8d
commit 5511a9d7e6
3 changed files with 22 additions and 1 deletions

2
.gitignore vendored
View File

@@ -8,3 +8,5 @@ config/auth.json
config/model.json
config/codex.json
CLAUDE.md
dist-exe/*
!dist-exe/*.tar.gz

Binary file not shown.

View File

@@ -64,7 +64,8 @@ function printHelp() {
说明:
默认 target 是 ${DEFAULT_TARGET},用于兼容 CentOS 7 这类老 glibc Linux x64 系统。
该命令只打包 cc-web 服务本体Claude/Codex CLI 仍在运行时从宿主机 PATH 或 CLAUDE_PATH/CODEX_PATH 调用。`);
该命令只打包 cc-web 服务本体Claude/Codex CLI 仍在运行时从宿主机 PATH 或 CLAUDE_PATH/CODEX_PATH 调用。
构建完成后会同时生成 dist-exe/<target>/ 和 dist-exe/cc-web-<target>.tar.gz。`);
}
function isWindowsTarget(target) {
@@ -170,6 +171,22 @@ function runBunBuild(projectRoot, target, outfile) {
}
}
function createArchive(outdir, target, name) {
const archivePath = path.join(outdir, `${name}-${target}.tar.gz`);
fs.rmSync(archivePath, { force: true });
const result = spawnSync('tar', ['-C', outdir, '-czf', archivePath, target], {
stdio: 'inherit',
});
if (result.error && result.error.code === 'ENOENT') {
throw new Error('未找到 tar无法生成发布压缩包。');
}
if (result.error) throw result.error;
if (result.status !== 0) {
throw new Error(`生成发布压缩包失败,退出码: ${result.status}`);
}
return archivePath;
}
function main() {
const options = parseArgs(process.argv.slice(2));
if (options.help) {
@@ -190,9 +207,11 @@ function main() {
runBunBuild(projectRoot, target, outfile);
if (!isWindowsTarget(target)) fs.chmodSync(outfile, 0o755);
copyRuntimeAssets(projectRoot, releaseDir, target, binaryName);
const archivePath = createArchive(outdir, target, options.name || DEFAULT_NAME);
console.log(`[build:single-exe] 发布目录: ${releaseDir}`);
console.log(`[build:single-exe] 可执行文件: ${outfile}`);
console.log(`[build:single-exe] 发布压缩包: ${archivePath}`);
}
try {