aboutsummaryrefslogtreecommitdiff
path: root/static/src/post-receive
diff options
context:
space:
mode:
Diffstat (limited to 'static/src/post-receive')
-rw-r--r--static/src/post-receive19
1 files changed, 19 insertions, 0 deletions
diff --git a/static/src/post-receive b/static/src/post-receive
new file mode 100644
index 0000000..9276a99
--- /dev/null
+++ b/static/src/post-receive
@@ -0,0 +1,19 @@
+# Skip build if using git push with -o or --push-option
+if [[ -v GIT_PUSH_OPTION_0 ]]; then
+ exit
+fi
+
+# Solution to
+# remote: fatal: not a git repository: '.'
+# https://git-scm.com/docs/githooks#_description
+unset GIT_DIR
+cd $(git worktree list | grep master | cut -d' ' -f1)
+git submodule update
+
+# Manually copy static since btrfs COW is super fast
+cp -r static /srv/http/tmp
+hugo --destination /srv/http/tmp
+
+# Replace with new build
+rm -r /srv/http/www
+mv /srv/http/tmp /srv/http/www