diff options
Diffstat (limited to 'post-receive')
| -rw-r--r-- | post-receive | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/post-receive b/post-receive new file mode 100644 index 0000000..18dedf6 --- /dev/null +++ b/post-receive @@ -0,0 +1,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 |
