Sha256: f4d251cca337a5fcbfcef223506517452c667a2f22cb4bfc4bd5ba8c43e3e8fa

Contents?: true

Size: 1.27 KB

Versions: 163

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

namespace :git do
  namespace :tag do
    desc "List tags from the Git repository"
    task :list do
      tags = `git tag -l`
      tags.gsub!("\r", "")
      tags = tags.split("\n").sort {|a, b| b <=> a }
      puts tags.join("\n")
    end

    desc "Create a new tag in the Git repository"
    task :create do
      changelog = File.open("CHANGELOG.md", "r") { |file| file.read }
      puts "-" * 80
      puts changelog
      puts "-" * 80
      puts

      v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
      abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION

      git_status = `git status`
      if git_status !~ /^nothing to commit/
        abort "Working directory isn't clean."
      end

      tag = "#{PKG_NAME}-#{PKG_VERSION}"
      msg = "Release #{PKG_NAME}-#{PKG_VERSION}"

      existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
      if existing_tags.include?(tag)
        warn("Tag already exists, deleting...")
        unless system "git tag -d #{tag}"
          abort "Tag deletion failed."
        end
      end
      puts "Creating git tag '#{tag}'..."
      unless system "git tag -a -m \"#{msg}\" #{tag}"
        abort "Tag creation failed."
      end
    end
  end
end

task "gem:release" => "git:tag:create"

Version data entries

163 entries across 150 versions & 20 rubygems

Version Path
postfinancecheckout-ruby-sdk-4.4.0 vendor/bundle/ruby/3.1.0/gems/addressable-2.8.6/tasks/git.rake
postfinancecheckout-ruby-sdk-4.2.0 vendor/bundle/ruby/3.0.0/gems/addressable-2.8.6/tasks/git.rake
wallee-ruby-sdk-4.2.0 vendor/bundle/ruby/3.0.0/gems/addressable-2.8.6/tasks/git.rake
addressable-2.8.6 tasks/git.rake
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/addressable-2.8.5/tasks/git.rake
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/addressable-2.8.5/tasks/git.rake
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/addressable-2.8.5/tasks/git.rake
addressable-2.8.5 tasks/git.rake
cloudsmith-api-2.0.7 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
cloudsmith-api-2.0.6 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
cloudsmith-api-2.0.5 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
cloudsmith-api-2.0.4 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
cloudsmith-api-2.0.3 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
cloudsmith-api-2.0.2 vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/tasks/git.rake
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/addressable-2.8.4/tasks/git.rake
addressable-2.8.4 tasks/git.rake
addressable-2.8.3 tasks/git.rake
addressable-2.8.2 tasks/git.rake
postfinancecheckout-ruby-sdk-3.3.0 vendor/bundle/ruby/2.7.0/gems/addressable-2.8.1/tasks/git.rake
wallee-ruby-sdk-3.3.0 vendor/bundle/ruby/2.7.0/gems/addressable-2.8.1/tasks/git.rake