12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/bash
- #hook/pre-receive
- #CONFIG
- echo "- - - - PRE-RECEIVE - - - -"
- REPO="sites/all/modules/features"
- echo $REPO
- #read oldrev newrev refname
- refname="refs/heads/sandbox"
- if [ $refname = "refs/heads/prod" ]; then
- BASE="public_html/base_d7"
- elif [ $refname = "refs/heads/sandbox" ]; then
- BASE="public_html/base_d7_sb"
- else
- BASE="none"
- fi
- echo $BASE
- if [ $BASE != "none" ]; then
- echo "===== UPDATE REPOSITORY | $refname ====="
- unset GIT_DIR
- cd ~
- cd $BASE
- cd $REPO
- git add .
- git commit -m "Auto Commit"
- echo "====== OK ====="
- else
- echo "Warning Commit not deployed, please use sandbox or prod branch"
- fi
- #!/bin/bash
- #hook/post-receive
- #CONFIG
- echo "- - - - POST-RECEIVE - - - - "
- REPO="sites/all/modules/features"
- echo $REPO
- #read oldrev newrev refname
- refname="refs/heads/prod"
- if [ $refname = "refs/heads/prod" ]; then
- BASE="public_html/base_d7"
- elif [ $refname = "refs/heads/sandbox" ]; then
- BASE="public_html/base_d7_sb"
- else
- BASE="none"
- fi
- echo $BASE
- if [ $BASE != "none" ]; then
- echo "===== DEPLOYING APP | $refname ====="
- unset GIT_DIR
- cd ~
- cd $BASE
- cd $REPO
- if [ $refname = "refs/heads/prod" ]; then
- git pull --ff-only origin prod
- elif [ $refname = "refs/heads/sandbox" ]; then
- git pull --ff-only origin sandbox
- fi
- echo $?
- echo "====== OK ====="
- else
- echo "Warning : Commit not deployed, please use prod branch"
- fi
|