Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/bin/bash
  2. TARGET="/var/www/html"
  3. GIT_DIR="/home/ubuntu/crm.git"
  4. BRANCH="master"
  5. TARGET_HOMOLOGACAO="/home/ubuntu/homologacao"
  6. # GIT_DIR="/home/ubuntu/crm"
  7. BRANCH_HOMOLOGACAO="homologacao"
  8.  
  9. while read oldrev newrev ref
  10. do
  11. # only checking out the master (or whatever branch you would like to deploy)
  12. if [ "$ref" = "refs/heads/$BRANCH" ]
  13. then
  14. echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
  15. git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
  16. fi
  17. if [ "$ref" = "refs/heads/$BRANCH_HOMOLOGACAO" ]
  18. then
  19. echo "Ref $ref received. Deploying ${BRANCH_HOMOLOGACAO} branch to homologacao..."
  20. git --work-tree=$TARGET_HOMOLOGACAO --git-dir=$GIT_DIR checkout -f $BRANCH_HOMOLOGACAO
  21. fi
  22.  
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement