2 # Directory where to deploy files from repository
4 # Directory containing repository
5 DPGIT_DIR
="{{GITDIR}}/{{PROJECT}}.git"
6 # Branch that is going to be deployed to server
9 while read oldrev newrev ref
11 # if DPTARGET is empty we don't want deploy for this project
12 if [[ ! "" == $DPTARGET ]]; then
13 # let's check that we are deploying to the correct branch
14 if [[ $ref = refs
/heads
/${DPBRANCH} ]]; then
15 echo "Ref $ref received. Deploying ${DPBRANCH} branch to production..."
16 git
--work-tree=$DPTARGET --git-dir=$DPGIT_DIR checkout
-f $DPBRANCH
17 NOW
=$
(date +"%d%m%Y-%H%M")
18 git tag release_
$NOW $DPBRANCH
19 echo " /==============================="
20 echo " | DEPLOYMENT COMPLETED"
21 echo " | Target branch: $DPTARGET"
22 echo " | Target folder: $DPGIT_DIR"
23 echo " | Tag name : release_$NOW"
24 echo " \=============================="
26 echo "Ref $ref received. Doing nothing: only the ${DPBRANCH} branch may be deployed on this server."
29 echo "Target directory not declared. Skipping deploy to server."