From bf17268d0207c8edd7cdf8ae81696804a72708be Mon Sep 17 00:00:00 2001 From: haemka Date: Fri, 14 Aug 2026 11:12:23 +0000 Subject: [PATCH] Expose build commit/branch to templates via SITE_COMMIT/SITE_BRANCH pelicanconf.py reads them from env vars (blank on a plain local build); the CI workflow's Build step now sets SITE_COMMIT (short SHA) and SITE_BRANCH before invoking pelican. Bumps the theme submodule to pick up the matching footer change (427fd9d). --- .gitea/workflows/build-deploy.yml | 5 +++++ pelicanconf.py | 7 +++++++ themes/latex | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml index d63155c..b246cc9 100644 --- a/.gitea/workflows/build-deploy.yml +++ b/.gitea/workflows/build-deploy.yml @@ -59,9 +59,14 @@ jobs: # main -> real prod config; staging -> prod-like preview (feeds, # absolute URLs) pointed at the dev webserver; devel (or anything # else) -> bare pelicanconf.py, same as a plain local build. + # SITE_COMMIT/SITE_BRANCH are picked up by pelicanconf.py (and thus + # every config that imports it) for the footer build-info line. env: REF_NAME: ${{ github.ref_name }} + GITEA_SHA: ${{ github.sha }} run: | + export SITE_COMMIT=$(echo "$GITEA_SHA" | cut -c1-8) + export SITE_BRANCH="$REF_NAME" if [ "$REF_NAME" = "main" ]; then pelican -s publishconf.py elif [ "$REF_NAME" = "staging" ]; then diff --git a/pelicanconf.py b/pelicanconf.py index 569f7d2..5b5b335 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- # from __future__ import unicode_literals +import os + AUTHOR = 'haemka' SITENAME = '[hɐəmkɑ]' SITEURL = 'http://haemka-de.wd.haemka.lan' @@ -50,6 +52,11 @@ SOCIAL = ( ('Matrix', 'matrix:u/haemka:matrix.org', 'matrix'), ) +# Build info shown in the footer, set by the CI workflow (blank on a +# plain local build). +SITE_COMMIT = os.environ.get('SITE_COMMIT', '') +SITE_BRANCH = os.environ.get('SITE_BRANCH', '') + DEFAULT_PAGINATION = False RELATIVE_URLS = True diff --git a/themes/latex b/themes/latex index b7022ae..427fd9d 160000 --- a/themes/latex +++ b/themes/latex @@ -1 +1 @@ -Subproject commit b7022aecd2d8a440d45489a24bfc63775007b353 +Subproject commit 427fd9db8b0465080526f53045274fb98a2ed29d