Created
November 3, 2016 05:37
-
-
Save arangates/7c104798399d65cb34c41d31e911920c to your computer and use it in GitHub Desktop.
My pre-receive hook to update my website when I "git push origin master:live"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while read old new branch | |
do | |
case "$new-$branch" in | |
000000000000000000*) | |
: echo "ignore deleted" | |
;; | |
*-refs/heads/live ) | |
echo "UPDATING LIVE SITE"; | |
git archive $new | ( | |
mkdir /tmp/XX.$$ | |
cd /tmp/XX.$$ || exit 1 | |
umask 022 | |
tar xf - | |
rsync --delete -rlpgocv lib/ /web/geekcruises-secure/lib-ng/ | |
cd /tmp || exit 1 | |
rm -rf XX.$$ | |
) | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment