feat(deploy): tag di versione nei msg Telegram, +1 ad ogni deploy

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>
This commit is contained in:
Adriano Dal Pastro
2026-06-02 14:34:18 +00:00
parent d624fe74c9
commit 4770a8368f
7 changed files with 79 additions and 3 deletions
+3 -1
View File
@@ -6,6 +6,8 @@ import urllib.request
import urllib.parse
import json
from src.version import APP_VERSION
BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "")
CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID", "")
@@ -30,7 +32,7 @@ def send_telegram(text: str) -> bool:
def notify_event(event: str, data: dict | None = None):
if event not in NOTIFY_EVENTS:
return
lines = [f"📊 <b>{event}</b>"]
lines = [f"📊 <b>{event}</b> <code>v{APP_VERSION}</code>"]
if data:
for k, v in data.items():
if k in ("signal",):
+18
View File
@@ -0,0 +1,18 @@
"""Versione dell'app, incrementata ad ogni deploy. Compare nei messaggi Telegram per correlare
i msg al codice in esecuzione. Sorgente: file VERSION nella root (cotto nell'immagine al build).
Bump: scripts/bump_version.py (o scripts/deploy.sh, che bumpa+committa+rebuilda)."""
from __future__ import annotations
from pathlib import Path
_VERSION_FILE = Path(__file__).resolve().parents[1] / "VERSION"
def get_version() -> str:
try:
return _VERSION_FILE.read_text().strip()
except Exception:
return "0.0.0"
APP_VERSION = get_version()