3 desc 'List tags from the Git repository'
7 tags = tags.split('\n').sort {|a, b| b <=> a }
11 desc 'Create a new tag in the Git repository'
13 changelog = File.open('CHANGELOG.md', 'r') { |file| file.read }
19 v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
20 abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
22 tag = "#{PKG_NAME}-#{PKG_VERSION}"
23 msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
25 existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
26 if existing_tags.include?(tag)
27 warn('Tag already exists, deleting...')
28 unless system "git tag -d #{tag}"
29 abort 'Tag deletion failed.'
32 puts "Creating git tag '#{tag}'..."
33 unless system "git tag -a -m \"#{msg}\" #{tag}"
34 abort 'Tag creation failed.'
40 task 'gem:release' => 'git:tag:create'