Sha256: fc68e659e45ce460e1025f85c15137f2eea032d8a0f2284f677261a6a90919b9
Contents?: true
Size: 1.83 KB
Versions: 13
Compression:
Stored size: 1.83 KB
Contents
#!/usr/bin/env ruby VERSION_PATH = File.expand_path('../../lib/grafana-rb/version.rb', __FILE__) CHANGELOG_PATH = File.expand_path('../../CHANGELOG.md', __FILE__) current_version = File.read(VERSION_PATH).split("\n").find { |l| l.index("VERSION") }.split('"')[1] major, minor, patch = current_version.split(".", 3).map(&:to_i) dev = !!current_version.index("-dev") if ARGV[0] == "patch" && !dev version = "#{major}.#{minor}.#{patch + 1}" next_version = "#{major}.#{minor}.#{patch + 1}" elsif ARGV[0] == "minor" && dev && patch == 0 version = "#{major}.#{minor}.0" next_version = "#{major}.#{minor + 1}.0-dev" elsif ARGV[0] == "major" && dev && patch == 0 version = "#{major + 1}.0.0" next_version = "#{major + 1}.1.0-dev" else puts "Current version: #{current_version}" unless dev puts "./bin/release patch # => #{major}.#{minor}.#{patch + 1}" end if dev puts "./bin/release minor # => #{major}.#{minor}.0" puts "./bin/release major # => #{major + 1}.0.0" end exit end def exec(cmd) puts "[exec] #{cmd}" system cmd end puts "releasing version: #{version}" exec %(git add .) exec %(git commit -am"uncommitted changes before release #{version}") exec %(git pull --rebase) File.write(VERSION_PATH, File.read(VERSION_PATH).sub(/VERSION = ".*?"/, %(VERSION = "#{version}"))) File.write(CHANGELOG_PATH, "## Grafana-rb #{version} (#{Time.now.strftime("%B %-d, %Y")}) ##\n\n" + File.read(CHANGELOG_PATH)) exec %(git commit -am"Release #{version}") exec %(git tag v#{version}) exec %(git push) exec %(git push --tags) exec %(gem build grafana-rb.gemspec) exec %(gem push grafana-rb-#{version}.gem) exec %(rm -f grafana-rb-#{version}.gem) File.write(VERSION_PATH, File.read(VERSION_PATH).sub(/VERSION = ".*?"/, %(VERSION = "#{next_version}"))) exec %(git commit -am"Start version #{next_version}") exec %(git push) puts "Done."
Version data entries
13 entries across 13 versions & 1 rubygems