diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 345ac5e..aeea837 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -48,4 +48,4 @@ jobs: max_attempts: 5 retry_wait_seconds: 2 warning_on_retry: false - command: curl -sSL --fail -m 10 https://charasheet.augendre.info + command: curl -sSL --fail -m 10 https://charasheet.augendre.info | grep $GITHUB_SHA > /dev/null diff --git a/src/charasheet/context_processors.py b/src/charasheet/context_processors.py new file mode 100644 index 0000000..18ab923 --- /dev/null +++ b/src/charasheet/context_processors.py @@ -0,0 +1,5 @@ +from django.conf import settings + + +def app(request): + return settings.APP diff --git a/src/charasheet/settings.py b/src/charasheet/settings.py index e2a67c7..e288d1e 100644 --- a/src/charasheet/settings.py +++ b/src/charasheet/settings.py @@ -109,6 +109,7 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", + "charasheet.context_processors.app", ], }, }, @@ -223,3 +224,26 @@ SERVER_EMAIL = "charasheet@mg.augendre.info" if DEBUG: EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" + +APP = { + "build": { + "date": "latest-date", + "commit": "latest-commit", + "describe": "latest-describe", + } +} +try: + with open("/app/git/build-date") as f: + APP["build"]["date"] = f.read().strip() +except Exception: # noqa: S110 + pass +try: + with open("/app/git/git-commit") as f: + APP["build"]["commit"] = f.read().strip() +except Exception: # noqa: S110 + pass +try: + with open("/app/git/git-describe") as f: + APP["build"]["describe"] = f.read().strip() +except Exception: # noqa: S110 + pass diff --git a/src/common/templates/common/base.html b/src/common/templates/common/base.html index 145ddd9..421968f 100644 --- a/src/common/templates/common/base.html +++ b/src/common/templates/common/base.html @@ -23,13 +23,16 @@ {% block head_end %} {% endblock %} -
+ {% include "common/navbar.html" %} -