Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Tools/Release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions Tools/Release/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 --------------------------------------------------------
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions Tools/Release/release.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading