Skip to content

Instantly share code, notes, and snippets.

Created Mar 25, 2014
What would you like to do?
hook to automatically deploy an app, when pushes to a repository is made. The script has to be placed in .git/hooks/post-receive and made executable. Script taken from:
# blog post:
## store the arguments given to the script
read oldrev newrev refname
## Where to store the log information about the updates
# The deployed directory (the running site)
## Record the fact that the push has been received
echo -e "Received Push Request at $( date +%F )" >> $LOGFILE
echo " - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
## Update the deployed copy
echo "Starting Deploy" >> $LOGFILE
echo " - Starting code update"
GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
echo " - Finished code update"
echo " - Starting post deployment work"
cd "$DEPLOYDIR"; echo "dot the i's and slash the t's"; cd -
echo " - Finished post deployment work"
echo "Finished Deploy" >> $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment