diff --git a/.woodpecker.yml b/.woodpecker.yml index e23d4be..94961a7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -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}}')"