feat: use tar for bundles
release / build-web (push) Has been cancelled
release / build-bundles (aarch64-linux-gnu-gcc, arm64, linux, ubuntu-latest, linux-arm64) (push) Has been cancelled
release / build-bundles (amd64, darwin, macos-15-large, macos-x64) (push) Has been cancelled
release / build-bundles (amd64, linux, ubuntu-latest, linux-x64) (push) Has been cancelled
release / build-bundles (amd64, windows, windows-latest, windows-x64) (push) Has been cancelled
release / build-bundles (arm64, darwin, macos-14, macos-arm64) (push) Has been cancelled
release / build-web (push) Has been cancelled
release / build-bundles (aarch64-linux-gnu-gcc, arm64, linux, ubuntu-latest, linux-arm64) (push) Has been cancelled
release / build-bundles (amd64, darwin, macos-15-large, macos-x64) (push) Has been cancelled
release / build-bundles (amd64, linux, ubuntu-latest, linux-x64) (push) Has been cancelled
release / build-bundles (amd64, windows, windows-latest, windows-x64) (push) Has been cancelled
release / build-bundles (arm64, darwin, macos-14, macos-arm64) (push) Has been cancelled
This commit is contained in:
+5
-14
@@ -1,26 +1,17 @@
|
||||
import AdmZip from "adm-zip";
|
||||
import tar from "tar";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
export function extractZip(zipPath: string, destDir: string): void {
|
||||
const zip = new AdmZip(zipPath);
|
||||
zip.extractAllTo(destDir, true);
|
||||
|
||||
// adm-zip doesn't preserve Unix file permissions, so mark binaries executable
|
||||
const binDir = path.join(destDir, "kandev", "bin");
|
||||
if (fs.existsSync(binDir)) {
|
||||
for (const file of fs.readdirSync(binDir)) {
|
||||
fs.chmodSync(path.join(binDir, file), 0o755);
|
||||
}
|
||||
}
|
||||
export function extractTarGz(archivePath: string, destDir: string): void {
|
||||
tar.extract({ file: archivePath, cwd: destDir, sync: true });
|
||||
}
|
||||
|
||||
export function ensureExtracted(zipPath: string, destDir: string): void {
|
||||
export function ensureExtracted(archivePath: string, destDir: string): void {
|
||||
const marker = path.join(destDir, ".extracted");
|
||||
if (fs.existsSync(marker)) {
|
||||
return;
|
||||
}
|
||||
extractZip(zipPath, destDir);
|
||||
extractTarGz(archivePath, destDir);
|
||||
fs.writeFileSync(marker, "");
|
||||
}
|
||||
|
||||
|
||||
+3
-9
@@ -43,10 +43,10 @@ async function prepareReleaseBundle({
|
||||
const platformDir = getPlatformDir();
|
||||
const release = await getRelease(version);
|
||||
const tag = release.tag_name || "latest";
|
||||
const assetName = `kandev-${platformDir}.zip`;
|
||||
const assetName = `kandev-${platformDir}.tar.gz`;
|
||||
const cacheDir = path.join(CACHE_DIR, tag, platformDir);
|
||||
|
||||
const zipPath = await ensureAsset(release, assetName, cacheDir, (downloaded, total) => {
|
||||
const archivePath = await ensureAsset(release, assetName, cacheDir, (downloaded, total) => {
|
||||
const percent = total ? Math.round((downloaded / total) * 100) : 0;
|
||||
const mb = (downloaded / (1024 * 1024)).toFixed(1);
|
||||
const totalMb = total ? (total / (1024 * 1024)).toFixed(1) : "?";
|
||||
@@ -54,7 +54,7 @@ async function prepareReleaseBundle({
|
||||
});
|
||||
process.stderr.write("\n");
|
||||
|
||||
ensureExtracted(zipPath, cacheDir);
|
||||
ensureExtracted(archivePath, cacheDir);
|
||||
const bundleDir = findBundleRoot(cacheDir);
|
||||
|
||||
const backendBin = path.join(bundleDir, "bin", getBinaryName("kandev"));
|
||||
@@ -67,12 +67,6 @@ async function prepareReleaseBundle({
|
||||
throw new Error(`agentctl binary not found at ${agentctlBin}`);
|
||||
}
|
||||
|
||||
// Ensure binaries are executable (adm-zip doesn't preserve Unix permissions)
|
||||
if (process.platform !== "win32") {
|
||||
fs.chmodSync(backendBin, 0o755);
|
||||
fs.chmodSync(agentctlBin, 0o755);
|
||||
}
|
||||
|
||||
const actualBackendPort = backendPort ?? (await pickAvailablePort(DEFAULT_BACKEND_PORT));
|
||||
const actualWebPort = webPort ?? (await pickAvailablePort(DEFAULT_WEB_PORT));
|
||||
const agentctlPort = await pickAvailablePort(DEFAULT_AGENTCTL_PORT);
|
||||
|
||||
Reference in New Issue
Block a user