Simple RubyGem for tagging and deploying versioned releases of an application to Heroku with the ability to do rollbacks.
If you are using Bundler, add a gem dependency like this:
group :development, :test do gem 'heroku_release', '~> version known to work' end
Require the Rake tasks in your Rakefile:
You have a few configuration options. If you are using a Git remote other than “heroku” then you must configure that. You can choose to have the release version written to a file on deploy so you can check the version on the live server. You can also choose to have a CHANGELOG file auto-generated. Here is a configuration example:
HerokuRelease.config.heroku_remote = "production" # git remote for heroku, defaults to "heroku" HerokuRelease.config.version_file_path = "public/version" # if not set no version file will be generated HerokuRelease.config.changelog_path = "CHANGELOG" # if not set no changelog file will be generated HerokuRelease.config.branch = 'production' # defaults to 'master'
To deploy the master branch to production, use the heroku_release rake task:
rake heroku_release COMMENT="This is a comment describing what changed since the last release"
To deploy another branch to production, send the BRANCH env variable:
rake heroku_release BRANCH="production_branch"
If the deploy went horribly wrong and you need to do a rollback you can do so:
In order to see the changelog:
To examine git commits since the last release you can do:
This library is released under the MIT license.
It seems Heroku is working on incorporating rollback functionality into the heroku command. Something to look into…
This gem was inspired by this gist.