Skip to content

Instantly share code, notes, and snippets.

@santiblanko
Created December 16, 2013 02:49
Show Gist options
  • Save santiblanko/7981645 to your computer and use it in GitHub Desktop.
Save santiblanko/7981645 to your computer and use it in GitHub Desktop.
Post-receive hook with composer.
it --work-tree=/var/www/laravel --git-dir=/var/repo/gob.git checkout -f
## store the arguments given to the script
#read oldrev newrev refname
## Where to store the log information about the updates
LOGFILE=./post-receive.log
# The deployed directory (the running site)
DEPLOYDIR=/var/www/laravel
## 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 composer update"
cd "$DEPLOYDIR"; composer update; cd -
echo " - Finished composer update"
echo "Finished Deploy" >> $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment