fix release artifact packaging on linux
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user