Created
March 28, 2012 05:03
-
-
Save rsanheim/2223786 to your computer and use it in GitHub Desktop.
Simple continuous deployment via Jenkins and Capistrano for all branches. Wire this up with Github post receive hooks from Jenkins for best results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# standard build stuff here | |
# bundle, rake, script/test or whatever | |
echo | |
echo "Beginning deploy from $GIT_BRANCH...." | |
echo | |
git remote prune origin | |
git fetch origin | |
git branch -t -f local/$GIT_BRANCH $GIT_BRANCH | |
git checkout local/$GIT_BRANCH | |
git pull | |
bundle exec cap staging deploy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# standard build stuff here | |
# bundle, rake, script/test or whatever | |
echo | |
echo "Beginning deploy from $GIT_BRANCH...." | |
echo | |
git remote prune origin | |
git fetch origin | |
git branch -t -f local/$GIT_BRANCH $GIT_BRANCH | |
git checkout local/$GIT_BRANCH | |
git pull | |
bundle exec cap staging deploy |
Hey -- I'm trying to get this set up and for whatever reason when SSH'd in to the server Capistrano is fine. But when run through Jenkins I see:
Running shell script
+ bundle exec cap production deploy
Could not locate Gemfile or .bundle/ directory
script returned exit code 10
Any ideas why that might be happening? I'm sure it's on my end. Thanks for the script!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Realized (thanks to feedback from Jason Rudolph) after posting this that it would be safer and better to deploy from a tag instead of a branch. Revision forthcoming...