a pre-release version (0.0.0-rehearsal.1) passes the one-version test; release.ts puts the checkout back when the fast gate fails before anything is committed

This commit is contained in:
CRTkafa 2026-10-15 01:46:02 +08:00
parent cd1e13c1e2
commit ef81dd1b3e
2 changed files with 8 additions and 3 deletions

View file

@ -271,7 +271,12 @@ async function main(): Promise<void> {
setVersion(version);
if (!rehearsal) writeFileSync(join(ROOT, 'CHANGELOG.md'), cutChangelog(readFileSync(join(ROOT, 'CHANGELOG.md'), 'utf8'), version, new Date().toISOString().slice(0, 10)));
const code = await bg('ci:quick', ['bun', 'run', 'ci:quick'], join(logDir, 'ci-quick.log'), { timeoutMs: 15 * 60_000 });
if (code !== 0) fail(`bun run ci:quick failed (${join(logDir, 'ci-quick.log').replace(HOME, '~')}); the bump is not committed (git checkout -- . to undo)`);
if (code !== 0) {
// nothing was committed or pushed: put the checkout back as it was
sh(['git', 'checkout', '-q', '--', '.']);
if (rehearsal) { sh(['git', 'checkout', '-q', startBranch === 'HEAD' ? head : startBranch]); sh(['git', 'branch', '-q', '-D', branch], { allowFail: true }); }
fail(`bun run ci:quick failed (${join(logDir, 'ci-quick.log').replace(HOME, '~')}); nothing committed, the checkout is back as it was`);
}
const me = `${sh(['git', 'config', 'user.name']).trim()} <${sh(['git', 'config', 'user.email']).trim()}>`;
if (me !== identity) fail(`git identity is ${me}; the commits on main are by ${identity} (git config user.name / user.email)`);
sh(['git', 'add', '-A']);