#!/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