diff --git a/cli/scripts/release-all.ts b/cli/scripts/release-all.ts index 9f1c9a34..2a87dfe0 100644 --- a/cli/scripts/release-all.ts +++ b/cli/scripts/release-all.ts @@ -41,6 +41,23 @@ function run(cmd: string, cwd = projectRoot): void { } } +async function runWithTimeoutRetry(cmd: string, cwd = projectRoot): Promise { + const timeoutCmd = `timeout 60s ${cmd}`; + while (true) { + console.log(`\n$ ${timeoutCmd}`); + if (dryRun) { + return; + } + try { + execSync(timeoutCmd, { cwd, stdio: 'inherit' }); + return; + } catch { + console.warn(`āš ļø ${cmd} failed or timed out. Retrying in 60s...`); + await new Promise(resolve => setTimeout(resolve, 60_000)); + } + } +} + async function main(): Promise { const flags = [dryRun && 'dry-run', publishNpm && 'publish-npm', skipBuild && 'skip-build'].filter(Boolean); console.log(`\nšŸš€ Starting release v${version}${flags.length ? ` (${flags.join(', ')})` : ''}\n`); @@ -108,7 +125,7 @@ async function main(): Promise { // Step 5: bun install to get complete lockfile console.log('\nšŸ“„ Step 4: Updating lockfile...'); - run('bun install', repoRoot); + await runWithTimeoutRetry('bun install', repoRoot); // Step 6: Git commit + tag + push console.log('\nšŸ“ Step 6: Creating git commit and tag...'); run(`git add .`, repoRoot);