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

# post-receive hook for the webserver

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

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

trap cleanup EXIT

while read oldrev newrev ref; do
    if [ "$ref" == "refs/heads/master" ]; then
	tmpdir=$(mktemp -d)
	cd $tmpdir
	git --work-tree=. --git-dir="$GIT_DIR" checkout -f
	gmake compress
	rsync -rcvP --delete out/ "$TARGET"
    fi
done