The concepts used in this workflow can be used with any deployment engine, however we use Capistrano and have published our git+capistrano deployment recipe that allows you to easily implement this workflow in any git+capistrano project.

Requires the cap multistage extension:

gem install capistrano capistrano-ext

INSTALLATION: require the gitflow file after your multistage require

require 'capistrano/ext/multistage'

require 'git-deployment/gitflow.rb'

Expects stages "staging" and "production".

USE:

PUSH TO STAGING:

Whenever you want to push the currently checked-out code to staging, just do:

cap staging deploy

gitflow will automatically:

- create a unique tag in the format of 'staging-YYYY-MM-DD.X'

- configure multistage to use that tag for the deploy

- push the code and tags to the remote "origin"

- and run the normal deploy task for the staging stage.

PUSH TO PRODUCTION:

Whenever you want to push code to production, you must specify the staging tag you wish to promote to production:

cap production deploy -s tag=staging-2009-09-08.2

gitflow will automatically:

- alias the staging tag to a production tag like: production-2008-09-08.2