Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. ## store the arguments given to the script
  4. read oldrev newrev refname
  5.  
  6. ## Where to store the log information about the updates
  7. LOGFILE=./post-receive.log
  8. # The deployed directory (the running site)
  9. DEPLOYDIR=/directory/to/deploy/to
  10. GITDIR=/directory/above/hooks/repo_name.git
  11.  
  12. ## Record the fact that the push has been received
  13. echo -e "Received Push Request at $( date +%Y-%m-%d:%H:%M:%S )" >> $LOGFILE
  14. echo " - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
  15.  
  16. ## Update the deployed copy
  17. echo "Starting Deploy" >> $LOGFILE
  18.  
  19. echo " - Starting code deployment (to $DEPLOYDIR)"
  20. # GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
  21. cd "$DEPLOYDIR";
  22. git --git-dir="$GITDIR" --work-tree="$DEPLOYDIR" checkout -f;
  23. git --git-dir="$GITDIR" --work-tree="$DEPLOYDIR" submodule update --init --recursive
  24. cd -
  25. echo " - Finished code deployment"
  26.  
  27. echo "Finished Deploy
  28.  
  29. " >> $LOGFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement