aboutsummaryrefslogtreecommitdiff
path: root/post-receive
blob: 18dedf6131d32825fa194276ba332f53338a8e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# post-receive hook for the webserver

TARGET="/var/www/htdocs/slimegirl.nexus"
GIT_DIR="/var/www/pub/git/slimegirl.nexus"

tmpdir=$(mktemp -d) || exit 1

cleanup() { rm -rf "$tmpdir"; }

while read oldrev newrev ref; do
    if [ "$ref" = "refs/head/master" ]; then
	echo "!!deploying!!"
	cd $tmpdir
	git --work-tree=. --git-dir="$GIT_DIR" checkout -f
	gmake clean && gmake compress
	rsync -rcvP --delete out/ "$TARGET"
    fi
done

trap cleanup EXIT