Created
May 14, 2013 13:54
-
-
Save itsme-renee/5576044 to your computer and use it in GitHub Desktop.
git post receive hook example
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 | |
##change website.com to your website | |
APP_PATH=/var/www/website.com | |
exit_with_error() { | |
echo "[DEPLOY] !!!!!!!!!!!!!!!!!!!! An error has occurred !!!!!!!!!!!!!!!!!!!!!!!" | |
exit 1 | |
} | |
# Initial directory is .git, so go to the working copy directory | |
mkdir -p ${APP_PATH} | |
cd ${APP_PATH} | |
echo "**********************************************************************" | |
echo " Deploying application... " | |
echo "**********************************************************************" | |
echo "[DEPLOY] - * Updating application working tree" | |
env -i git add . | |
env -i git reset --hard || exit_with_error | |
env -i git pull origin master | |
echo "[DEPLOY] - * Updating git submodules" | |
env -i git submodule update --init | |
echo "[DEPLOY] - * Running database migrations" | |
php oil r migrate | |
echo "[Deploy] - * Running database migrations for package=sentry" | |
php oil refine migrate --packages=sentry | |
echo "[DEPLOY] - * Successfully deployed application to ${APP_PATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment