Load exact deployment revision directly from local Gitea
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Keith Casko committed 2026-10-23 01:11:52 -04:00
1 parent 0158560a68
commit fdc7ddeee2
1 file changed
+9 -7
+9 -7
View File
@@ -2,13 +2,9 @@ when:
branch: master
event: push
clone:
git:
image: woodpeckerci/plugin-git
settings:
partial: false
depth: 1
lfs: false
# Both Gitea and this deployment already use the same Docker host. Read the
# exact commit from its local bare repository, avoiding the broken upload-pack hook.
skip_clone: true
steps:
deploy:
@@ -18,6 +14,12 @@ steps:
commands:
- |
set -eu
case "$CI_COMMIT_SHA" in
""|*[!0-9a-f]*) echo "Invalid deployment revision"; exit 1 ;;
esac
docker exec gitea git --git-dir=/data/git/repositories/keith/keith-portfolio.git cat-file -e "$CI_COMMIT_SHA^{commit}"
docker exec gitea git --git-dir=/data/git/repositories/keith/keith-portfolio.git archive --format=tar "$CI_COMMIT_SHA" | tar xf -
echo "Loaded exact source revision $CI_COMMIT_SHA from local Gitea"
CONTAINER_ID="$(docker ps --filter publish=8091 --format '{{.ID}}' | head -n 1)"
test -n "$CONTAINER_ID" || { echo "No running portfolio container found on port 8091"; exit 1; }
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"