#!/bin/sh

# example git post-receive hook that i use to autobuild my website on push

# set variables, change example.com to your website repo name
GIT_REPO=$HOME/example.com.git
TMP_GIT_CLONE=$HOME/tmp/example.com
AAOTH_ROOT=/var/www/htdocs/example.com
AAOTH_GEMROOT=/var/gemini/example.com

export AAOTH_ROOT AAOTH_GEMROOT

# change branch name to your main deploy branch
git clone -b main "$GIT_REPO" "$TMP_GIT_CLONE"

# build the site
cd "$TMP_GIT_CLONE" && ./build.sh

# clean up
rm -Rf "$TMP_GIT_CLONE"
exit