chore: publish CentOS7 single executable package
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -8,3 +8,5 @@ config/auth.json
|
|||||||
config/model.json
|
config/model.json
|
||||||
config/codex.json
|
config/codex.json
|
||||||
CLAUDE.md
|
CLAUDE.md
|
||||||
|
dist-exe/*
|
||||||
|
!dist-exe/*.tar.gz
|
||||||
|
|||||||
BIN
dist-exe/cc-web-bun-linux-x64-baseline.tar.gz
Normal file
BIN
dist-exe/cc-web-bun-linux-x64-baseline.tar.gz
Normal file
Binary file not shown.
@@ -64,7 +64,8 @@ function printHelp() {
|
|||||||
|
|
||||||
说明:
|
说明:
|
||||||
默认 target 是 ${DEFAULT_TARGET},用于兼容 CentOS 7 这类老 glibc Linux x64 系统。
|
默认 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) {
|
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() {
|
function main() {
|
||||||
const options = parseArgs(process.argv.slice(2));
|
const options = parseArgs(process.argv.slice(2));
|
||||||
if (options.help) {
|
if (options.help) {
|
||||||
@@ -190,9 +207,11 @@ function main() {
|
|||||||
runBunBuild(projectRoot, target, outfile);
|
runBunBuild(projectRoot, target, outfile);
|
||||||
if (!isWindowsTarget(target)) fs.chmodSync(outfile, 0o755);
|
if (!isWindowsTarget(target)) fs.chmodSync(outfile, 0o755);
|
||||||
copyRuntimeAssets(projectRoot, releaseDir, target, binaryName);
|
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] 发布目录: ${releaseDir}`);
|
||||||
console.log(`[build:single-exe] 可执行文件: ${outfile}`);
|
console.log(`[build:single-exe] 可执行文件: ${outfile}`);
|
||||||
|
console.log(`[build:single-exe] 发布压缩包: ${archivePath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user