Created
October 27, 2017 19:39
-
-
Save otaavioo/62f682ceb05ff4b42cb44a2c15d6b129 to your computer and use it in GitHub Desktop.
deploy project with docker
This file contains hidden or 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 | |
# Colors | |
RESET="\033[0m" | |
CY="\033[1;33m" | |
CG="\033[0;32m" | |
_verify_parameters() | |
{ | |
branch=$1 | |
if [ -z $branch ] | |
then | |
printf "\\n %s " "Para executar o deploy-local, utilize o comando abaixo:" | |
printf " %s\\n" "./deploy branch-name" | |
exit 1 | |
fi | |
} | |
_checkout_branch() | |
{ | |
branch=$1 | |
git pull --all | |
branch_exists=$(git branch -a | grep remotes/origin/$branch) | |
if [ -n $branch_exists ] | |
then | |
git checkout $branch | |
git pull origin $branch | |
return | |
fi | |
git checkout producao | |
git pull origin producao | |
_run_composer | |
} | |
_run_composer() | |
{ | |
./composer install | |
} |
This file contains hidden or 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 | |
path=$(pwd) | |
. /www/deploy/functions.sh | |
cd /www/path-to-dir/ | |
_verify_parameters $1 | |
_checkout_branch $1 | |
cd $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment