From 5ee7fdbf68e9411059a1337640fece4b42e2046c Mon Sep 17 00:00:00 2001 From: Senthilkumar Panneerselvam Date: Fri, 17 Nov 2023 10:17:52 +0100 Subject: [PATCH 1/2] Show code version --- .github/workflows/dockerhub.yml | 3 +++ layouts/partials/footer.html | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index a9901d7..c7caf10 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -64,3 +64,6 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: HUGO_ENV_ARG=${{ github.event_name == 'release' && format('{0}-{1}', 'production', github.ref_name) + || github.ref_name == 'main' && format('{0}-{1}', 'production', github.sha) + || format('{0}-{1}', 'development', github.sha) }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 446dac3..8824230 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -21,8 +21,14 @@ Knut and Alice Wallenberg Foundation logo + + {{ $env_info := split hugo.Environment "-" }} + {{ $code_version := substr (index $env_info 1) 0 7 }}
- Website code (GitHub) + + Website code on GitHub{{ with $code_version }} ({{ $code_version }}){{ end }} + Privacy notice
From 7c135851a2e8243096c5d8b3ad086c2404e993e4 Mon Sep 17 00:00:00 2001 From: Senthilkumar Panneerselvam Date: Fri, 17 Nov 2023 10:30:10 +0100 Subject: [PATCH 2/2] Show full release name --- layouts/partials/footer.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8824230..a3d4276 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -23,7 +23,8 @@ {{ $env_info := split hugo.Environment "-" }} - {{ $code_version := substr (index $env_info 1) 0 7 }} + {{ $git_sha := index $env_info 1 }} + {{ $code_version := cond (strings.HasPrefix $git_sha "v") $git_sha (substr $git_sha 0 7) }}