Last active
August 29, 2015 14:03
-
-
Save abihf/0917349375fad6df9869 to your computer and use it in GitHub Desktop.
Git auto deploy on push
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 | |
read oldrev newrev refname | |
branch=`echo "$refname" | cut -d/ -f3` | |
if [ "master" = "$branch" ] | |
then | |
deploy_target=`git config --get deploy.target` | |
if [ -z "$deploy_target" ]; then | |
echo "Deploy target have not been set"; | |
exit 1 | |
fi | |
echo " - deploying to $deploy_target" | |
echo " - updating git from $oldrev to $newrev" | |
GIT_WORK_TREE="$deploy_target" git checkout -f | |
if [ -e "$deploy_target/composer.json" ]; then | |
echo " - runing composer install" | |
composer --working-dir="$deploy_target" install | |
fi | |
echo "Finished Deploy" | |
else | |
echo "Push to master to deploying app" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment