From 0df22458d65dbfc6e14a070d71765bcaa640614a Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 12 Feb 2022 16:39:15 +0100 Subject: feat: add post-receive hook --- hooks/post-receive | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 hooks/post-receive diff --git a/hooks/post-receive b/hooks/post-receive new file mode 100755 index 0000000..58d831e --- /dev/null +++ b/hooks/post-receive @@ -0,0 +1,21 @@ +#!/bin/sh + +# This hook will update the static website whenever with new commits on each push. + +export LC_TYPE="en_US.UTF-8" + +www="/var/www/git" +src="$(pwd)" +name=$(basename "$src") +dst="$www/$(basename "$name" '.git')" + +[ ! -d dst ] && mkdir -p "$dst" +cd "$dst" || exit 1 + +echo "[stagit] building $dst" +stagit "$src" + +echo "[stagit] linking $dst" +ln -sf log.html index.html +ln -sf ../style.css style.css +ln -sf ../logo.png logo.png -- cgit v1.2.3-70-g09d2