Add build.sh wrapper that bumps the explicit dev/test build segment (scripts/bump-dev-build.py) for test builds and validates release version state (scripts/check-release-version.py) for releases. Update build-and-push.sh accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
830 B
Python
Executable File
28 lines
830 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Validate Novela release version state before a release build.
|
|
|
|
Releases must ship with BUILD = 0 so the sidebar shows a clean semantic
|
|
version (e.g. v0.2.11) instead of a dev build (e.g. v0.2.11.3).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
VERSION_FILE = ROOT / "containers" / "novela" / "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}")
|
|
|
|
build = int(match.group(1))
|
|
if build != 0:
|
|
raise SystemExit(
|
|
f"Release builds require BUILD = 0 in {VERSION_FILE}; found BUILD = {build}. "
|
|
f"Reset it before releasing."
|
|
)
|
|
|
|
print("[check-release-version] BUILD = 0")
|