Created
August 4, 2016 16:21
-
-
Save jrlangford/7b40a4f7350a57940b0124a2bd93c9f5 to your computer and use it in GitHub Desktop.
Git production repo post-receive hook to automatically deploy code.
This file contains 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/bash | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]]; | |
then | |
echo "Master ref received, deploying master branch to production" | |
git --work-tree=<Target dir from which static content will be served> --git-dir=<source bare repo dir> checkout -f && \ | |
echo "Success, master branch deployed!!" || \ | |
echo "Error while deploying master branch" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment