Guest User

Untitled

a guest
Jan 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #!/bin/bash
  2. # requires that you use "set :deploy_via, :remote_cache" in deploy.rb
  3.  
  4. while read oldrev newrev ref
  5. do
  6. if [ "$ref" = "refs/heads/master" ] ; then
  7. echo "Master branch pushed, deploying to staging"
  8. # seams to be set to "." for hooks, unset to make things more normal
  9. unset GIT_DIR
  10. # deploy path, where "current", "releases", "shared" etc are
  11. DEPLOYDIR="/home/user/deploy/staging"
  12. # default path for :deploy_via :remote_cache is shared/cached-copy
  13. cd "$DEPLOYDIR/shared/cached-copy"
  14. # update cache to pushed revision, will be done by capistrano too
  15. git fetch origin && git fetch --tags origin && git reset --hard "$newrev"
  16. # load rvm
  17. source ~/.rvm/scripts/rvm
  18. rvm use 1.9.2
  19. # make sure we have a .bundle directory to make bundle exec happy.
  20. # lend the one from current deployed version
  21. cp -a "$DEPLOYDIR/current/.bundle" .
  22. # run capistrano
  23. # if you use deploy:migrations instead of deploy you should probably add
  24. # after "deploy:migrations", "deploy:cleanup"
  25. # to your deploy.rb
  26. bundle exec cap staging deploy:migrations
  27. fi
  28. done
Add Comment
Please, Sign In to add comment