From 22ce03d1f019d143c09b29efcab817edecd5a6f1 Mon Sep 17 00:00:00 2001 From: Daniel Maksymilian Syrnicki Date: Wed, 26 Aug 2026 13:35:40 +0200 Subject: [PATCH] fix(website): build on Hugo 0.147 again (site.Data), chown site trees even when the CI build fails hugo.Data is not available in the alpine Hugo the deploy job uses; the failed render left the webroot half-cleaned and root-owned because the chown only ran after a successful build. It is an EXIT trap now. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01MScAinbyMdeNc7H2BZdnnG --- website/deploy-ci.sh | 13 +++++++------ website/layouts/poll/single.html | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/website/deploy-ci.sh b/website/deploy-ci.sh index 608d55d..f7c781e 100755 --- a/website/deploy-ci.sh +++ b/website/deploy-ci.sh @@ -11,6 +11,13 @@ HERE="$(cd "$(dirname "$0")" && pwd)" SRCROOT="${FURTKA_SRCROOT:-/srv/furtka-site}" WEBROOT="${FURTKA_WEBROOT:-/var/www/furtka.org}" +# The runner job runs as root inside the container; hand the trees back +# to the VM user no matter how this script ends, so the manual deploy.sh +# path keeps working even after a failed build. +if [ "$(id -u)" = 0 ]; then + trap 'chown -R "${FURTKA_OWNER:-1000:1000}" "$SRCROOT" "$WEBROOT"' EXIT +fi + echo "==> rsync website/ → $SRCROOT" rsync -az --delete \ --exclude='.hugo_build.lock' \ @@ -24,10 +31,4 @@ echo "==> hugo build → $WEBROOT" cd "$SRCROOT" hugo --minify --cleanDestinationDir -d "$WEBROOT" -# The runner job runs as root inside the container; hand the trees back -# to the VM user so the manual deploy.sh path keeps working afterwards. -if [ "$(id -u)" = 0 ]; then - chown -R "${FURTKA_OWNER:-1000:1000}" "$SRCROOT" "$WEBROOT" -fi - echo "OK: deployed to https://furtka.org/" diff --git a/website/layouts/poll/single.html b/website/layouts/poll/single.html index e62b99b..ae1065a 100644 --- a/website/layouts/poll/single.html +++ b/website/layouts/poll/single.html @@ -1,7 +1,7 @@ {{ define "main" }} {{- $p := .Params -}} -{{- $M := hugo.Data.logo.m -}} -{{- $R := hugo.Data.logo.r -}} +{{- $M := site.Data.logo.m -}} +{{- $R := site.Data.logo.r -}} {{- $s := $p.show -}}