Sha256: 23080c12d778a1b7e1b05ed24d39365c9182a337295ae645a796528b2046a1e5
Contents?: true
Size: 1.72 KB
Versions: 4
Compression:
Stored size: 1.72 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "optparse" require_relative "../lib/i18n-js/version" def write_file(path, contents) File.open(File.expand_path(path), "w") do |io| io << contents end end changelog_path = "./CHANGELOG.md" version_path = "./lib/i18n-js/version.rb" version = nil segments = I18nJS::VERSION.split(".") major, minor, patch = *segments.take(3).map(&:to_i) pre = segments[4].to_s pre_version = pre.gsub(/[^\d]/m, "").to_i date = Time.now.strftime("%b %d, %Y") dry_run = false alpha = false OptionParser.new do |opts| opts.on("--major") do version = "#{major + 1}.0.0" end opts.on("--minor") do version = "#{major}.#{minor + 1}.0" end opts.on("--patch") do version = "#{major}.#{minor}.#{patch + 1}" end opts.on("--alpha") do alpha = true end opts.on("--dry-run") do dry_run = true end end.parse! version = "#{version}.alpha#{pre_version + 1}" if alpha unless version puts "ERROR: You need to use either one of: --major, --minor, --patch" exit 1 end puts "=> Current version: #{I18nJS::VERSION}" puts "=> Next version: #{version}" system "yarn", "install" system "yarn", "compile" write_file changelog_path, File.read(changelog_path) .gsub("Unreleased", "v#{version} - #{date}") puts "=> Updated #{changelog_path}" write_file version_path, File.read(version_path) .gsub(/VERSION = ".*?"/, %[VERSION = "#{version}"]) puts "=> Updated #{version_path}" unless dry_run system "git", "add", changelog_path, version_path system "git", "commit", "-m", "Bump up version (v#{version})" system "rake", "release" end if dry_run system "rake", "build" system "git", "checkout", changelog_path, version_path end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
i18n-js-4.2.3 | bin/release |
i18n-js-4.2.2 | bin/release |
i18n-js-4.2.1 | bin/release |
i18n-js-4.2.0 | bin/release |