Use the git commit hash as the app version

- Spec header, status pill and footer now document '<env> @ <hash>'
  instead of invented release numbers
- Backend settings expose GIT_COMMIT_HASH / APP_ENV / APP_VERSION,
  mirroring the original app
- Frontend bakes the short hash in at build time and shows it in the
  top bar
This commit is contained in:
2026-09-17 08:12:54 -05:00
parent 3f353307cf
commit 3c66629ed2
5 changed files with 51 additions and 6 deletions
+19
View File
@@ -3,6 +3,7 @@ Django settings for the J621 backend.
"""
import os
import subprocess
from pathlib import Path
from dotenv import load_dotenv
@@ -19,6 +20,24 @@ ALLOWED_HOSTS = [
if host.strip()
]
def _git_commit_hash():
"""Short git hash of the running build, mirroring the original app."""
try:
return subprocess.check_output(
["git", "rev-parse", "--short", "HEAD"],
cwd=BASE_DIR,
text=True,
stderr=subprocess.DEVNULL,
).strip()
except (subprocess.SubprocessError, OSError):
return "unknown"
GIT_COMMIT_HASH = _git_commit_hash()
APP_ENV = "dev" if DEBUG else "prod"
APP_VERSION = f"{APP_ENV} @ {GIT_COMMIT_HASH}"
# Application definition
INSTALLED_APPS = [