From 758c3ce7ea6a088f25c241014e7ba022f9aad2db Mon Sep 17 00:00:00 2001 From: feco Date: Thu, 26 Nov 2026 20:51:54 +0000 Subject: [PATCH] CI deploy: a newline before a new TAG_ line, and repair a glued one The server's .env ended without a newline, so TAG_FRONTEND stuck to the last line (FORUM_URL=http://forum:8083TAG_FRONTEND=...): the forum gave 500 and the frontend kept its old image. The deploy now adds the missing newline first and puts any TAG_= that stuck to a line back on its own line. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- .gitea/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 75b4ff4..cdb805a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -202,7 +202,11 @@ jobs: pin="$pin (grep -q '^$var=' .env && sed -i 's/^$var=.*/$var=$tag/' .env || echo '$var=$tag' >> .env) &&" done scp -q deploy/docker-compose.yml deploy/Caddyfile "$HOST:$DIR/" - ssh "$HOST" "cd '$DIR' && $pin \ + # The .env may end without a newline (a line added by hand): one first, + # so a new TAG_ line does not stick to the last one; and a + # TAG_= that did stick (2026-11-26) goes back to its own line. + fix="sed -i -e '\$a\\' .env && sed -i -e 's/\\([^[:space:]]\\)\\(TAG_[A-Z_]*=\\)/\\1\\n\\2/' .env &&" + ssh "$HOST" "cd '$DIR' && $fix $pin \ docker compose pull -q && docker compose up -d --remove-orphans --wait && \ docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile && \ docker image prune -af >/dev/null"