aboutsummaryrefslogtreecommitdiffstats
path: root/post-receive.example
blob: 84a5b6c0599132da1a5468b3a362d5e9ba6f2aa0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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" && sh build.sh

# clean up
rm -Rf "$TMP_GIT_CLONE"
exit