Added support for customizable tag commit messages
This commit is contained in:
@@ -43,6 +43,15 @@ module Capistrano
|
||||
exists?(:git_remote) ? git_remote : `git remote`.strip.split(/\n/).first
|
||||
end
|
||||
|
||||
def commit_message(current_sha)
|
||||
if exists?(:deploytag_commit_message)
|
||||
deploytag_commit_message
|
||||
else
|
||||
tag_user = (ENV['USER'] || ENV['USERNAME'] || 'deployer').strip
|
||||
"#{tag_user} deployed #{current_sha} to #{stage}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.load_into(configuration)
|
||||
configuration.load do
|
||||
before 'deploy', 'git:prepare_tree'
|
||||
@@ -78,8 +87,7 @@ module Capistrano
|
||||
current_sha = `git rev-parse #{branch} HEAD`.strip[0..8]
|
||||
logger.log Capistrano::Logger::INFO, "Tagging #{current_sha} for deployment"
|
||||
|
||||
tag_user = (ENV['USER'] || ENV['USERNAME']).strip
|
||||
cdt.safe_run 'git', 'tag', '-a', cdt.git_tag_for(stage), '-m', "#{tag_user} deployed #{current_sha} to #{stage}"
|
||||
cdt.safe_run 'git', 'tag', '-a', cdt.git_tag_for(stage), '-m', cdt.commit_message(current_sha)
|
||||
cdt.safe_run 'git', 'push', '--tags' if cdt.has_remote?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user