[deploy] Add commit catpure to deploy step
Some checks failed
build & deploy / test (push) Failing after 1m31s
build & deploy / build-and-deploy (push) Has been skipped

This commit is contained in:
2026-05-01 16:48:58 -04:00
parent df2108807d
commit cbdb5c49d0
4 changed files with 124 additions and 4 deletions

View File

@ -12,6 +12,25 @@ def version_info(request):
commit = os.environ.get("VROBBLER_COMMIT")
if not commit:
# Try to import from _commit.py module first
try:
from vrobbler._commit import commit
except ImportError:
pass
else:
return {"app_version": app_version, "git_commit": commit}
# Try to read from commit file (written during deploy)
commit_file = Path("/var/lib/vrobbler/commit.txt")
if commit_file.exists():
try:
commit = commit_file.read_text().strip()
if commit:
return {"app_version": app_version, "git_commit": commit}
except OSError:
pass
# Fall back to git command
PROJECT_ROOT = Path(__file__).resolve().parent.parent
try:
commit = (