diff --git a/lib/voxpupuli-release/rake_tasks.rb b/lib/voxpupuli-release/rake_tasks.rb index 8af2643..734d081 100644 --- a/lib/voxpupuli-release/rake_tasks.rb +++ b/lib/voxpupuli-release/rake_tasks.rb @@ -1,15 +1,35 @@ -require 'puppet_blacksmith/rake_tasks' -Blacksmith::RakeTask.new do |t| - t.build = false # do not build the module nor push it to the Forge - # just do the tagging [:clean, :tag, :bump_commit] -end +desc 'release new version through Travis-ci' +task "travis_release" do + + require 'puppet_blacksmith/rake_tasks' + Blacksmith::RakeTask.new do |t| + t.build = false # do not build the module nor push it to the Forge + # just do the tagging [:clean, :tag, :bump_commit] + end + + m = Blacksmith::Modulefile.new + v = m.version + raise "Refusing to release an RC or build-release (#{v}).\n" + + "Please set a semver *release* version." unless v =~ /^\d+\.\d+.\d+$/ -desc 'Offload release process to Travis.' -task travis_release: [ - :check_changelog, # check that the changelog contains an entry for the current release - :"module:release", # do everything except build / push to forge, travis will do that for us -] + Rake::Task[:check_changelog].invoke + # do a "manual" module:release (clean, tag, bump, commit, push tags) + Rake::Task["module:clean"].invoke + + # idempotently create tags + g = Blacksmith::Git.new + Rake::Task["module:tag"].invoke unless g.exec_git("tag -l v#{v}").strip == "v#{v}" + + v_inc = m.increase_version(v) + v_new = "#{v_inc}-rc0" + ENV['BLACKSMITH_FULL_VERSION'] = v_new + Rake::Task["module:bump:full"].invoke + + # push it out, and let travis do the release: + g.commit_modulefile!(v_new) + g.push! +end desc 'Check Changelog.' task :check_changelog do