post-receive.example (view raw)
1#!/bin/sh
2
3# example git post-receive hook that i use to autobuild my website on push
4
5# set variables, change example.com to your website repo name
6GIT_REPO=$HOME/example.com.git
7TMP_GIT_CLONE=$HOME/tmp/example.com
8AAOTH_ROOT=/var/www/htdocs/example.com
9AAOTH_GEMROOT=/var/gemini/example.com
10
11export AAOTH_ROOT AAOTH_GEMROOT
12
13# change branch name to your main deploy branch
14git clone -b main "$GIT_REPO" "$TMP_GIT_CLONE"
15
16# build the site
17cd "$TMP_GIT_CLONE" && ./build.sh
18
19# clean up
20rm -Rf "$TMP_GIT_CLONE"
21exit