From 9a59e772cd9f12c8bc085dc48bdba3a9e289e4e6 Mon Sep 17 00:00:00 2001 From: Keith Casko Date: Tue, 6 Oct 2026 00:48:06 -0400 Subject: [PATCH] Add portfolio deployment pipeline --- .woodpecker.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..8568b94 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,26 @@ +when: + branch: master + event: push + +steps: + deploy: + image: docker:cli + volumes: + - /root/lab:/host-lab + - /var/run/docker.sock:/var/run/docker.sock + commands: + - | + set -eu + CONTAINER_ID="$(docker ps --format '{{.ID}} {{.Ports}}' | awk '/:8091->80\/tcp/ {print $1; exit}')" + 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}}')" + test -n "$HOST_SITE" || { echo "Portfolio container has no /usr/share/nginx/html bind mount"; exit 1; } + case "$HOST_SITE" in + /root/lab/*) TARGET="/host-lab/${HOST_SITE#/root/lab/}" ;; + *) echo "Unexpected portfolio site path: $HOST_SITE"; exit 1 ;; + esac + test -f "$TARGET/index.html" || { echo "Target index.html not found: $TARGET"; exit 1; } + grep -q "Keith Casko" "$TARGET/index.html" || { echo "Target does not look like casko.dev portfolio"; exit 1; } + cp -a index.html homelab.html css js assets "$TARGET/" + docker restart "$CONTAINER_ID" + echo "Deployed commit $CI_COMMIT_SHA to $HOST_SITE"