Last active
February 11, 2022 15:07
-
-
Save jeansf/746b1e1a93315713444ef6807904bfb2 to your computer and use it in GitHub Desktop.
Shell Script Update
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 | |
echo "" | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "║ ██████╗ █████╗ ██████╗██╗ ██╗ ███████╗███╗ ██╗██████╗ ║" | |
echo "║ ██╔══██╗██╔══██╗██╔════╝██║ ██╔╝ ██╔════╝████╗ ██║██╔══██╗ ║" | |
echo "║ ██████╔╝███████║██║ █████╔╝█████╗█████╗ ██╔██╗ ██║██║ ██║ ║" | |
echo "║ ██╔══██╗██╔══██║██║ ██╔═██╗╚════╝██╔══╝ ██║╚██╗██║██║ ██║ ║" | |
echo "║ ██████╔╝██║ ██║╚██████╗██║ ██╗ ███████╗██║ ╚████║██████╔╝ ║" | |
echo "║ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═════╝ ║" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Parando serviços ├────────────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
supervisorctl stop all | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Atualizando dependências ├────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
if [ -f "composer.phar" ] | |
then | |
if [[ ${GIT_TOKEN} && ${GIT_TOKEN-x} ]]; then | |
php composer.phar config -g github-oauth.github.com ${GIT_TOKEN} | |
fi | |
php composer.phar install | |
else | |
if [[ ${GIT_TOKEN} && ${GIT_TOKEN-x} ]]; then | |
composer config -g github-oauth.github.com ${GIT_TOKEN} | |
fi | |
composer install | |
fi | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Apagando cache ├──────────────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
if [ -f "cachetool.phar" ] | |
then | |
php cachetool.phar opcache:reset --cli | |
echo "OPCache reseted" | |
fi | |
php bin/console cache:clear --env=prod | |
php bin/console d:c:clear-m --env=prod | |
php bin/console d:c:clear-r --env=prod | |
php bin/console doctrine:cache:clear-query --env=prod | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Iniciando serviços ├──────────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
supervisorctl start all | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" |
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 | |
for i in "$@" | |
do | |
case $i in | |
-git|--git) | |
curl -sS "https://gist.githubusercontent.com/jeansf/746b1e1a93315713444ef6807904bfb2/raw/git.sh?$(date +%s)" | bash -s -- "$@" | |
;; | |
--frontend) | |
curl -sS "https://gist.githubusercontent.com/jeansf/746b1e1a93315713444ef6807904bfb2/raw/frontend.sh?$(date +%s)" | bash -s -- "$@" | |
;; | |
--backend) | |
curl -sS "https://gist.githubusercontent.com/jeansf/746b1e1a93315713444ef6807904bfb2/raw/backend.sh?$(date +%s)" | bash -s -- "$@" | |
;; | |
*) | |
esac | |
done | |
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 | |
echo "" | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "║ ███████╗██████╗ ██████╗ ███╗ ██╗████████╗ ███████╗███╗ ██╗██████╗ ║" | |
echo "║ ██╔════╝██╔══██╗██╔═══██╗████╗ ██║╚══██╔══╝ ██╔════╝████╗ ██║██╔══██╗ ║" | |
echo "║ █████╗ ██████╔╝██║ ██║██╔██╗ ██║ ██║█████╗█████╗ ██╔██╗ ██║██║ ██║ ║" | |
echo "║ ██╔══╝ ██╔══██╗██║ ██║██║╚██╗██║ ██║╚════╝██╔══╝ ██║╚██╗██║██║ ██║ ║" | |
echo "║ ██║ ██║ ██║╚██████╔╝██║ ╚████║ ██║ ███████╗██║ ╚████║██████╔╝ ║" | |
echo "║ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═════╝ ║" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Instalando dependências ├─────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
npm install | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Deploy ├──────────────────────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
ng build --base-href=/ --outputPath=/var/www/html --prod | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" |
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 | |
echo "" | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "║ ██████╗ ██╗████████╗ ║" | |
echo "║ ██╔════╝ ██║╚══██╔══╝ ║" | |
echo "║ ██║ ███╗██║ ██║ ║" | |
echo "║ ██║ ██║██║ ██║ ║" | |
echo "║ ╚██████╔╝██║ ██║ ║" | |
echo "║ ╚═════╝ ╚═╝ ╚═╝ ║" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" | |
branch="master" | |
currentBranch=$(git branch | grep \* | cut -d ' ' -f2) | |
for i in "$@" | |
do | |
case $i in | |
-b=*|--branch=*) | |
branch="${i#*=}" | |
;; | |
*) | |
esac | |
done | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╟────┤ Atualizando código ├──────────────────────────────────────────────────────────────╢" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" | |
echo "▁▂▃▅▆▇ $branch ▇▆▅▃▂▁" | |
echo "" | |
if [ "$currentBranch" != "$branch" ] | |
then | |
git fetch origin $branch | |
git checkout $branch --force | |
fi | |
git pull origin $branch | |
echo "╔════════════════════════════════════════════════════════════════════════════════════════╗" | |
echo "╚════════════════════════════════════════════════════════════════════════════════════════╝" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment