#!/bin/bash -x # This should be your "script/ci" checked into version control, and then wired as your sole build step in Jenkins. # # Simplifying Assumptions: # # * You build all branches # * You want to deploy all branches. # * You wired up an SSH key to your CI server appropriately so it can talk to your deployment target(s) via Cap set -e script/test # or bundle exec rake, or whatever echo "Beginning deploy from $GIT_BRANCH...." # Do some git clean up and checkout and pull a branch # Jenkins by default will be in a detached HEAD state, which Capistrano doesn't like 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 deploy