From 9d71d06a1f3ee294634bf45373bbf1944bf03caf Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Sat, 19 Sep 2026 19:42:42 +0800 Subject: chore: add self-hosted deploy pipeline (blog-deploy) --- deploy/git-hook/post-receive | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 deploy/git-hook/post-receive (limited to 'deploy/git-hook') diff --git a/deploy/git-hook/post-receive b/deploy/git-hook/post-receive new file mode 100755 index 00000000..65cec98a --- /dev/null +++ b/deploy/git-hook/post-receive @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Runs INSIDE the gitweb container (uid 1000) on git-http-backend pushes. +# Only writes a signal into the bare repo; the host systemd path unit +# (/home/somhairle/git/blog.git/deploy.signal) picks it up and builds. +set -u +ZERO=0000000000000000000000000000000000000000 +GITDIR=$(git rev-parse --git-dir 2>/dev/null) || exit 0 +while read -r oldrev newrev refname; do + case "$refname" in + refs/heads/main) + if [ "$newrev" != "$ZERO" ]; then + if printf '%s %s\n' "$newrev" "$(date -u +%FT%TZ)" > "$GITDIR/deploy.signal" 2>/dev/null; then + echo "blog-deploy: build signal written for $newrev" >&2 + else + echo "blog-deploy: WARNING could not write deploy.signal" >&2 + fi + fi + ;; + esac +done +exit 0 -- cgit v1.2.3