Sha256: 5ce79825ab1252647dd0791f28e70ce2132b1810cc7ae38caba7807cea0aacfc

Contents?: true

Size: 980 Bytes

Versions: 2

Compression:

Stored size: 980 Bytes

Contents

#!/usr/bin/env ruby
require 'json'
require 'time'

ENV['GITHUB_TOKEN'] = 'cebfd9d48eb57bee07660aea1eb166e4ac00d44a'
ENV['TRAVIS_REPO_SLUG'] = 'wojtekmach/minitest-metadata'

sha = `git rev-parse HEAD`.strip
tag = "v%s" % File.read(File.expand_path('../../VERSION', __FILE__)).strip
token = ENV.fetch('GITHUB_TOKEN')
repo  = ENV.fetch('TRAVIS_REPO_SLUG')

cmd = "curl -H \"Authorization: token %{token}\" -XPOST https://api.github.com/repos/%{repo}/git/refs -d '%{json}'" % {
  token: token,
  repo: repo,
  json: JSON(
    ref: "refs/tags/#{tag}",
    sha: sha,
  )
}
unless system cmd
  puts "Failed"
  exit 1
end

json = JSON(
  tag: tag,
  object: sha,
  type: "commit",
  tagger: {
    name: `git config user.name`.strip,
    email: `git config user.email`.strip,
    date: Time.now.iso8601,
  }
)

cmd = "curl -H \"Authorization: token %{token}\" -XPOST https://api.github.com/repos/%{repo}/git/tags -d '%{json}'" % {
  token: token,
  repo: repo,
  json: json,
}
system cmd

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minitest-metadata-0.5.3 script/make_tag
minitest-metadata-0.5.2 script/make_tag