diff --git a/AGENTS.md b/AGENTS.md index b0c6f0d..d5b01ea 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -288,7 +288,8 @@ would want. every testing track. Never promote a testing build to production. - A game moves to the next minor version (x.y.z to x.(y+1).0) once its current version has an approved release on either store; until then each - build keeps the version and takes only the next build number. + build keeps the version and takes only the next build number. A patch of 0 + is left off (1.5, not 1.5.0); any other patch stays (1.4.1). - Google Play goes through the runtime's `Tools/Play/play.js` (its README), run through the game's own two-line `play.js` with its `listing.json` and `play.json`: never `gplay` writes of your own, and never a copy of the diff --git a/Tools/Release/README.md b/Tools/Release/README.md index 7ba70a6..b5ed666 100644 --- a/Tools/Release/README.md +++ b/Tools/Release/README.md @@ -115,8 +115,8 @@ Tools/Release/nightly.sh --notes notes.txt # the release (the nigh 2. **Worktree.** Everything happens in a throwaway worktree of the branch, with the runtime submodule, removed at the end; the checkout it's run from is only fetched. -3. **Version.** The minor goes up (1.7 → 1.8, 1.4.1 → 1.5.0) once the - version has an approved release on either store: an App Store version +3. **Version.** The minor goes up (1.7 → 1.8, 1.4.1 → 1.5, a patch of 0 + left off) once the version has an approved release on either store: an App Store version Apple approved (waiting for release, live, or later replaced or removed), or a production release on Play that names the version and that Google approved (`play.js versions --approved`). Then the next build number. Both diff --git a/Tools/Release/lib.js b/Tools/Release/lib.js index e4316a4..d092964 100644 --- a/Tools/Release/lib.js +++ b/Tools/Release/lib.js @@ -44,15 +44,20 @@ function withVersion(text, from, to) { (value.replace(/"/g, '').trim() === from ? `MARKETING_VERSION = ${to};` : line)); } -// The next minor version, with as many parts as this one: 1.7 → 1.8, -// 1.4.1 → 1.5.0. +// The next minor version, written without a patch of 0: 1.7 → 1.8, +// 1.4.1 → 1.5 (1.5.0 with its patch of 0 left off). function bumpMinor(version) { const parts = String(version).split('.'); const [major, minor] = parts.map(Number); if (parts.length < 2 || parts.length > 3 || !Number.isInteger(major) || !Number.isInteger(minor)) { throw new Error(`MARKETING_VERSION isn't x.y or x.y.z: ${version}`); } - return parts.length === 2 ? `${major}.${minor + 1}` : `${major}.${minor + 1}.0`; + return withoutZeroPatch(`${major}.${minor + 1}.0`); +} + +// A version without a patch of 0 (1.5.0 is 1.5); any other patch stays (1.4.1). +function withoutZeroPatch(version) { + return String(version).replace(/^(\d+\.\d+)\.0$/, '$1'); } // --- Build numbers -------------------------------------------------------- @@ -218,7 +223,7 @@ function playRelease({ aab, name, notes, send }) { } module.exports = { - APP_STORE_APPROVED, PLATFORMS, projectSetting, withBuild, withVersion, bumpMinor, + APP_STORE_APPROVED, PLATFORMS, projectSetting, withBuild, withVersion, bumpMinor, withoutZeroPatch, highestTaken, nextBuild, thisBuild, androidName, patchName, ascData, ascBuildNumbers, ascUploadNumbers, appStoreApproved, newPRs, buildInSubject, buildSubject, bulleted, plainTitle, draftNotes, FALLBACK, fill, settingsFrom, nightlyProblems, playRelease, sameVersion, namesVersion, diff --git a/Tools/Release/release.test.js b/Tools/Release/release.test.js index 2da40d4..21abd28 100644 --- a/Tools/Release/release.test.js +++ b/Tools/Release/release.test.js @@ -24,12 +24,16 @@ test('the project: the app target is the last value; a bump leaves other targets assert.match(bumped, /MARKETING_VERSION = 1\.0;/); }); -test('the minor goes up with as many parts as the version has', () => { +test('the minor goes up to x.(y+1).0, written without its patch of 0', () => { assert.strictEqual(lib.bumpMinor('1.7'), '1.8'); - assert.strictEqual(lib.bumpMinor('1.4.1'), '1.5.0'); - assert.strictEqual(lib.bumpMinor('1.5.0'), '1.6.0'); + assert.strictEqual(lib.bumpMinor('1.4.1'), '1.5'); + assert.strictEqual(lib.bumpMinor('1.5.0'), '1.6'); assert.strictEqual(lib.bumpMinor('2.9'), '2.10'); assert.throws(() => lib.bumpMinor('7'), /x\.y/); + assert.strictEqual(lib.withoutZeroPatch('1.5.0'), '1.5'); + assert.strictEqual(lib.withoutZeroPatch('1.4.1'), '1.4.1'); + assert.strictEqual(lib.withoutZeroPatch('1.10.0'), '1.10'); + assert.strictEqual(lib.withoutZeroPatch('2.0'), '2.0'); }); test('build numbers: one past everything taken; a build now keeps an untaken project number', () => {