Bump versions only when a release is made

Between releases every change goes under one Unreleased section of
CHANGELOG.md and of each app's changelog; App packages already waits for
the next version. The version check accepts that leading section, and the
version test fixture copies the release notes script update_version.sh runs.
This commit is contained in:
waozi committed 2026-10-29 12:56:34 -03:00
1 parent 7ec840260e
commit c9a0eae23c
3 files changed
+18 -1

No files matched your search

+4 -1
View File
@@ -12,7 +12,10 @@
- Practice media (pictures, course data, recordings) lives in the
`practices` package (waozixyz/practices), not under
`assets/`. Commit media there, then update the lock here.
- Add the numeric release to `CHANGELOG.md`, then run `./update_version.sh`.
- Bump versions only for a release actually being made. Until then, note
every change under one `## [Unreleased]` section of `CHANGELOG.md` (and of
`apps/<app>/CHANGELOG.md`); App packages waits for the next version. At
release, number that section, then run `./update_version.sh`.
The canonical macros are `APP_VERSION_STRING`, `APP_VERSION_MAJOR`,
`APP_VERSION_MINOR`, and `APP_VERSION_PATCH`; do not create aliases.
Only the GitHub Actions release workflow creates or pushes release tags.
+3
View File
@@ -32,6 +32,9 @@ def validate(root, structure_only=False):
return (root / path).read_text(encoding="utf-8")
headings = re.findall(r"^## \[(.*?)\].*$", read("CHANGELOG.md"), re.MULTILINE)
# Changes collect under one Unreleased section until a release numbers it.
if headings[:1] == ["Unreleased"]:
headings = headings[1:]
if not headings or not re.fullmatch(VERSION_PATTERN, headings[0]):
raise ValueError("CHANGELOG.md: first release must have a numeric X.Y.Z version")
version = headings[0]
+11
View File
@@ -26,6 +26,7 @@ class VersionTest(unittest.TestCase):
"apps/lumi/CHANGELOG.md", "apps/leaderboard/CHANGELOG.md",
"src/apps/versions.zi",
"scripts/update-package-version.py", "scripts/generate-package-versions.py",
"scripts/release_notes.py",
"src/core/version.h", "src/core/version.zi",
"src/storage/sync_result.zi",
"droid/app/build.gradle", "windows/inbe.rc",
@@ -177,6 +178,16 @@ class VersionTest(unittest.TestCase):
result = subprocess.run(["sh", str(script), invalid], capture_output=True, check=False)
self.assertNotEqual(result.returncode, 0)
def test_unreleased_changes_keep_the_released_version(self):
code = re.search(r"versionCode (\d+)", self.read("droid/app/build.gradle"))[1]
name = "CHANGELOG.md"
self.write(name, self.read(name).replace(
"# Changelog\n", "# Changelog\n\n## [Unreleased]\n\n- A change waiting for the next release.\n", 1))
self.assertEqual(self.check("--print-version").stdout, f"{self.version}\n")
subprocess.run(["bash", str(self.root / "update_version.sh")], capture_output=True, text=True, check=True)
self.assertEqual(self.check("--print-version").stdout, f"{self.version}\n")
self.assertIn(f"versionCode {code}", self.read("droid/app/build.gradle"))
def test_updater_bumps_once_and_is_idempotent(self):
initial_code = int(re.search(r"versionCode (\d+)", self.read("droid/app/build.gradle"))[1])
name = "CHANGELOG.md"