23 lines
817 B
Python
Executable File
23 lines
817 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Increment Clearview's explicit dev/test build number."""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
VERSION_FILE = ROOT / "containers" / "clearview" / "src" / "clearview_app" / "version.py"
|
|
|
|
text = VERSION_FILE.read_text()
|
|
match = re.search(r"^BUILD = (\d+)\s*$", text, flags=re.MULTILINE)
|
|
if not match:
|
|
raise SystemExit(f"BUILD assignment not found in {VERSION_FILE}")
|
|
|
|
next_build = int(match.group(1)) + 1
|
|
text = text[: match.start(1)] + str(next_build) + text[match.end(1) :]
|
|
VERSION_FILE.write_text(text)
|
|
|
|
version_match = re.search(r'^VERSION = ["\']([^"\']+)["\']\s*$', text, flags=re.MULTILINE)
|
|
version = version_match.group(1) if version_match else "v?.?.?"
|
|
print(f"[bump-dev-build] {version}.{next_build}")
|