Class: Bozo::Hooks::GitTagRelease

Inherits:
Object
  • Object
show all
Defined in:
lib/bozo/hooks/git_tag_release.rb

Overview

Hook to tag a git repository when a release is published from a build server.

Instance Method Summary collapse

Instance Method Details

#post_publishObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bozo/hooks/git_tag_release.rb', line 7

def post_publish
  return unless build_server?
  log_info "Tagging repository for release #{env['BUILD_VERSION_FULL']}"

  tag_name = "rel-#{env['BUILD_VERSION_FULL']}"

  if `git tag`.split("\n").include? tag_name
    log_warn "The tag #{tag_name} already exists"
  else
    execute_command :git, ['git', 'tag', tag_name]
    execute_command :git, ['git', 'push', '--tags']
  end
end