diff --git a/scripts/ship-release.mjs b/scripts/ship-release.mjs index 4e9dcb7..3644a94 100644 --- a/scripts/ship-release.mjs +++ b/scripts/ship-release.mjs @@ -4,6 +4,7 @@ import { join } from 'node:path'; const qaVersion = process.env.PUBLIC_QA_VERSION ?? makeQaVersion(); +assertNoTrackedChanges(); runPnpmScript('verify:local-release'); runPnpmScript('qa:early'); writeReleaseManifest(qaVersion); @@ -17,6 +18,21 @@ function makeQaVersion() { return `ship-${stamp}`; } +function assertNoTrackedChanges() { + const result = spawnSync('git', ['status', '--porcelain', '--untracked-files=no'], { + cwd: process.cwd(), + encoding: 'utf8' + }); + if (result.status !== 0) { + throw new Error(`Could not inspect tracked git status before shipping:\n${result.stderr.trim()}`); + } + + const dirty = result.stdout.trim(); + if (dirty) { + throw new Error(`Refusing to ship release with uncommitted tracked changes:\n${dirty}`); + } +} + function writeReleaseManifest(qaVersion) { const manifest = { app: 'heros_web',