Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- TARGET="/var/www/html"
- GIT_DIR="/home/ubuntu/crm.git"
- BRANCH="master"
- TARGET_HOMOLOGACAO="/home/ubuntu/homologacao"
- # GIT_DIR="/home/ubuntu/crm"
- BRANCH_HOMOLOGACAO="homologacao"
- while read oldrev newrev ref
- do
- # only checking out the master (or whatever branch you would like to deploy)
- if [ "$ref" = "refs/heads/$BRANCH" ]
- then
- echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
- git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
- fi
- if [ "$ref" = "refs/heads/$BRANCH_HOMOLOGACAO" ]
- then
- echo "Ref $ref received. Deploying ${BRANCH_HOMOLOGACAO} branch to homologacao..."
- git --work-tree=$TARGET_HOMOLOGACAO --git-dir=$GIT_DIR checkout -f $BRANCH_HOMOLOGACAO
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement