Guest User

Untitled

a guest
May 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # An example hook script for the "post-receive" event.
  4. #
  5. # The "post-receive" script is run after receive-pack has accepted a pack
  6. # and the repository has been updated. It is passed arguments in through
  7. # stdin in the form
  8. # <oldrev> <newrev> <refname>
  9. # For example:
  10. # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
  11. #
  12. # see contrib/hooks/ for a sample, or uncomment the next line and
  13. # rename the file to "post-receive".
  14. #
  15. #. /usr/share/git-core/contrib/hooks/post-receive-email
  16.  
  17. WORKTREE=/home/{project_dir}
  18. GITDIR=/home/{project_repo}
  19.  
  20. echo "Entering $WORKTREE"
  21. echo `pwd`
  22. cd $WORKTREE || exit
  23. unset GIT_DIR
  24. git pull origin master
  25. LASTMSG=`git log -1 --pretty=format:"%s"`
  26. TRIM="$(echo "${LASTMSG}" | tr -d '\n')"
  27. NOW=$(date +"%Y%m%d-%H%M"z)
  28. cd $GITDIR
  29. # Fix
  30. while read oldrev newrev refname
  31. do
  32. echo " /==============================="
  33. echo " | DEPLOYMENT COMPLETED"
  34. echo " | Target branch: master"
  35. echo " | Target folder: $WORKTREE"
  36. echo " | Time: $NOW"
  37. echo " | Message: $TRIM"
  38. echo " \=============================="
  39. done
Add Comment
Please, Sign In to add comment