From 39fcfc813ae3340c7ec3d703a10c5a7bb1557aef Mon Sep 17 00:00:00 2001 From: fabi Date: Sun, 14 Jun 2026 18:33:13 +0200 Subject: [PATCH] chore(ci): persist deployed SHA into .env after deploy The deploy job exports MANGALORD_TAG in-shell only, so .env kept its `latest` placeholder and the live SHA was only visible via docker inspect. sed the built SHA into .env after a successful `up -d` (non-fatal) so .env reflects what's actually deployed and manual `docker compose up` is deterministic. Co-Authored-By: Claude Opus 4.8 --- .gitea/workflows/deploy.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 7cd3f7b..e3275f4 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -149,5 +149,12 @@ jobs: export MANGALORD_TAG="$IMAGE_TAG" docker compose pull mangalord-backend mangalord-frontend docker compose up -d mangalord-backend mangalord-frontend + # Persist the deployed SHA into .env so it reflects what's actually + # live. The export above is shell-only; without this, .env keeps its + # `latest` placeholder and `docker inspect` is the only way to see the + # running SHA. Runs only after a successful `up -d` (set -eu); kept + # non-fatal so a write hiccup can't fail an otherwise-good deploy. + sed -i "s/^MANGALORD_TAG=.*/MANGALORD_TAG=${IMAGE_TAG}/" .env \ + || echo "::warning::could not persist MANGALORD_TAG to .env" docker image prune -f docker logout "$REGISTRY_URL"