release: one release at a time (a lock with the pid in ~/.storebound-releases/release.lock): two runs once built into the same target folder and both failed
This commit is contained in:
parent
ddb813576e
commit
d2ae0fa765
1 changed files with 10 additions and 0 deletions
|
|
@ -247,6 +247,16 @@ async function main(): Promise<void> {
|
|||
const out = join(RELEASES, 'desktop', version);
|
||||
const logDir = join(RELEASES, 'logs', version);
|
||||
const host = publishHost();
|
||||
// one release at a time on this Mac: two runs once built into the same target folder and the signing failed
|
||||
if (yes) {
|
||||
const lock = join(RELEASES, 'release.lock');
|
||||
const held = existsSync(lock) ? Number(readFileSync(lock, 'utf8').trim()) : 0;
|
||||
const alive = held > 0 && (() => { try { process.kill(held, 0); return true; } catch { return false; } })();
|
||||
if (alive && held !== process.pid) fail(`another release runs (pid ${held}, ${lock.replace(HOME, '~')}): wait for it, or end it first`);
|
||||
mkdirSync(RELEASES, { recursive: true });
|
||||
writeFileSync(lock, `${process.pid}\n`);
|
||||
process.on('exit', () => { try { if (readFileSync(lock, 'utf8').trim() === String(process.pid)) rmSync(lock, { force: true }); } catch { /* gone */ } });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 1. preflight
|
||||
const remote = remoteSessionReason(process.env, sh(['launchctl', 'managername'], { allowFail: true }).trim());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue