-
-
Save cvega93/dfac192d3d9de4fccbbf23ea207a56df to your computer and use it in GitHub Desktop.
Easy automatic deploy bash for dummies
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 | |
projectname=$1; | |
#Para usar ejecutar sh deploy_git.sh [Nombre proyecto] [Scripts a ejecutar luego de deploy] | |
cd /var/www; | |
mkdir $projectname; | |
cd /var; | |
mkdir repo; | |
cd repo; | |
mkdir $projectname; | |
cd $projectname; | |
mkdir site.git; | |
cd site.git; | |
git init --bare; | |
cd hooks; | |
sudo touch post-receive; | |
myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"; | |
echo " | |
#!/bin/sh | |
cd /var/www/$projectname | |
git --work-tree=/var/www/$projectname --git-dir=/var/repo/$projectname/site.git checkout -f | |
${2} | |
" > post-receive; | |
sudo chmod +x post-receive; | |
green=`tput setaf 1` | |
reset=`tput sgr0` | |
echo "${green}---------LISTO PERRO YA TIENES TU REPO LEVANTADO-----${reset} | |
git remote add testing root@${myip}:/var/repo/$projectname/site.git | |
"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment