Updating a REVISION environment variable

kmayer edited this page Mar 25, 2012 · 1 revision

Sometimes you want your application to report what revision (aka git sha) it is running. The HerokuSan::Stage object has a method #revision which returns the current sha. Then you can use the #push_config method to update the environment variable of your choice with the new revision sha.

task :after_deploy do
  each_heroku_app do |stage|
    revision = stage.revision.split.first
    stage.push_config('REVISION' => revision) if revision
  end
end