From ef7874fcc09197c528f67a09c16ef7ded443525d Mon Sep 17 00:00:00 2001 From: hectorzhao Date: Sun, 28 Jun 2026 22:28:14 +0800 Subject: [PATCH] fix release artifact packaging on linux --- scripts/build-release-artifact.mjs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/build-release-artifact.mjs b/scripts/build-release-artifact.mjs index 9a98e6c..fa251d1 100644 --- a/scripts/build-release-artifact.mjs +++ b/scripts/build-release-artifact.mjs @@ -94,6 +94,11 @@ async function copyEntry(source, target) { const sourcePath = path.resolve(root, source); const targetPath = path.resolve(stagingDir, target); await fs.mkdir(path.dirname(targetPath), { recursive: true }); + await fs.rm(targetPath, { recursive: true, force: true }); + if (process.platform === 'linux') { + run('cp', ['-a', sourcePath, targetPath]); + return; + } await fs.cp(sourcePath, targetPath, { recursive: true, verbatimSymlinks: true }); } @@ -155,10 +160,12 @@ await fs.writeFile(path.join(stagingDir, 'RELEASE_MANIFEST.json'), `${JSON.strin await fs.mkdir(outDir, { recursive: true }); const tarPath = path.join(outDir, `${releaseId}.tar.gz`); run('tar', ['-czf', tarPath, '-C', stagingDir, '.'], { stdio: 'inherit' }); -const files = await collectFiles(stagingDir); +const fileCount = process.platform === 'linux' + ? Number(run('bash', ['-lc', `find ${JSON.stringify(stagingDir)} -type f | wc -l`])) + : (await collectFiles(stagingDir)).length; const artifactHash = await sha256(tarPath); await fs.writeFile(path.join(outDir, `${releaseId}.sha256`), `${artifactHash} ${path.basename(tarPath)}\n`, 'utf8'); console.log(`Release artifact created: ${tarPath}`); console.log(`SHA256: ${artifactHash}`); -console.log(`Files staged: ${files.length}`); +console.log(`Files staged: ${fileCount}`);