after "deploy:restart", "deploy:tag_last_deploy" namespace :deploy do # see http://codeintensity.blogspot.com/2008/06/changelogs-and-deployment-notification.html task :tag_last_deploy do set :tag_name, "deployed_to_#{rails_env}_#{timestamp_string_without_seconds}" `git tag -a -m "Tagging deploy to #{rails_env} at #{timestamp_string_without_seconds}" #{tag_name} #{branch}` `git push --tags` puts "Tagged release with #{tag_name}." end end def timestamp_string_without_seconds Time.now.strftime("%Y%m%d%H%M") end