4770a8368f
File VERSION (semver, cotto nell'immagine) letto da src/version.py. Compare nelle notifiche trade (telegram_notifier) e nel report orario -> sai quale codice ha generato quale msg. scripts/bump_version.py incrementa la patch; scripts/deploy.sh = bump+commit+rebuild (versione aumenta ad OGNI deploy). v1.0.0 = primo release versionato (include hurst loss-guard). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
863 B
Python
30 lines
863 B
Python
"""Incrementa la versione (semver) nel file VERSION. Default: patch +1.
|
|
Uso: uv run python scripts/bump_version.py [major|minor|patch] (default patch)
|
|
Stampa la nuova versione. Usato da scripts/deploy.sh ad ogni deploy."""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
VF = Path(__file__).resolve().parents[1] / "VERSION"
|
|
|
|
|
|
def main():
|
|
part = sys.argv[1] if len(sys.argv) > 1 else "patch"
|
|
cur = VF.read_text().strip() if VF.exists() else "0.0.0"
|
|
try:
|
|
major, minor, patch = (int(x) for x in cur.split("."))
|
|
except Exception:
|
|
major, minor, patch = 0, 0, 0
|
|
if part == "major":
|
|
major, minor, patch = major + 1, 0, 0
|
|
elif part == "minor":
|
|
minor, patch = minor + 1, 0
|
|
else:
|
|
patch += 1
|
|
new = f"{major}.{minor}.{patch}"
|
|
VF.write_text(new + "\n")
|
|
print(new)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|