Created
May 4, 2011 14:21
-
-
Save keo/955303 to your computer and use it in GitHub Desktop.
git deploy hook
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/sh | |
# super-duper post-receive hook | |
# (c) 2011 Barnabas Debreczeni <keo@goa.hu> | |
DEPLOY_TO=/webapps/cms | |
umask 002 | |
echo "++++++++++++++++++++++++++++++++++++++++++++ deploying to $DEPLOY_TO" | |
( | |
echo "===> copy files" && \ | |
export GIT_DIR=`pwd` && \ | |
git reset --hard && \ | |
echo "===> bundle install" && \ | |
cd $DEPLOY_TO && \ | |
bundle install --deployment && \ | |
echo "===> migrating database" && \ | |
rake db:migrate RAILS_ENV=production && \ | |
echo "===> restarting app" && \ | |
touch tmp/restart.txt && \ | |
echo "++++++++++++++++++++++++++++++++++++++++++ deploy SUCCESSFUL" | |
) || | |
echo "++++++++++++++++++++++++++++++++++++++++++ deploy FAILED!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment