summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-02-12 16:39:15 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-02-12 16:39:15 +0100
commit0df22458d65dbfc6e14a070d71765bcaa640614a (patch)
tree2a3cf388e67f48ff1a568135d9173ae8eca74673
parent7d2476df8391ca8044b5ceec6dc990ac1e33f846 (diff)
feat: add post-receive hook
-rwxr-xr-xhooks/post-receive21
1 files changed, 21 insertions, 0 deletions
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