diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5a9d65d..621cfe8 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -50,4 +50,4 @@ jobs: max_attempts: 5 retry_wait_seconds: 2 warning_on_retry: false - command: curl -sSL --fail -m 10 https://checkout.augendre.info | grep ${GITHUB_SHA::7} > /dev/null + command: curl -sSL --fail -m 10 https://checkout.augendre.info/ping/ | grep ${GITHUB_SHA::7} > /dev/null diff --git a/src/checkout/settings.py b/src/checkout/settings.py index 1566242..e344397 100644 --- a/src/checkout/settings.py +++ b/src/checkout/settings.py @@ -129,6 +129,7 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", + "common.context_processors.app", ], }, }, @@ -228,3 +229,26 @@ CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_TEMPLATE_PACK = "bootstrap5" MESSAGE_TAGS = {messages.ERROR: "danger"} + +APP = { + "build": { + "date": "latest-date", + "commit": "latest-commit", + "describe": "latest-describe", + }, +} +try: + with Path("/app/git/build-date").open() as f: + APP["build"]["date"] = f.read().strip() +except Exception: # noqa: S110 + pass +try: + with Path("/app/git/git-commit").open() as f: + APP["build"]["commit"] = f.read().strip() +except Exception: # noqa: S110 + pass +try: + with Path("/app/git/git-describe").open() as f: + APP["build"]["describe"] = f.read().strip() +except Exception: # noqa: S110 + pass diff --git a/src/common/context_processors.py b/src/common/context_processors.py new file mode 100644 index 0000000..956ba17 --- /dev/null +++ b/src/common/context_processors.py @@ -0,0 +1,5 @@ +from django.conf import settings + + +def app(_): + return settings.APP diff --git a/src/common/templates/common/ping.html b/src/common/templates/common/ping.html new file mode 100644 index 0000000..1288535 --- /dev/null +++ b/src/common/templates/common/ping.html @@ -0,0 +1,10 @@ +{% extends "common/base.html" %} +{% block content %} +