diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-09-05 19:21:55 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-09-05 19:21:55 +0300 |
commit | 5f35e85ec60de08af8aa15257a7fba2ab6a68135 (patch) | |
tree | c71a13af6d105eba742c1c287700d7340cea338f | |
parent | 934d09b8fac8301d787ca5322aab90da75b7675d (diff) |
Push stable branche when releasing a minor version
Now the patch release process depends on a stable branch to be there, or
not. Than creating one on demand. Given branches are cheap, we could do
this when the tag gets created.
-rwxr-xr-x | _support/publish | 14 | ||||
-rwxr-xr-x | _support/release | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/_support/publish b/_support/publish index e550db462..50a2808b0 100755 --- a/_support/publish +++ b/_support/publish @@ -19,7 +19,12 @@ def main(tag) abort "Git remote 'origin' must match #{REMOTE_REGEX}, got #{remote.inspect}" end - gem = "gitaly-#{tag.sub(/^v/, '')}.gem" + unless version.match?(/v\d+\.\d+\.\d+/) + abort "Version string #{version.inspect} does not look like a Gitaly Release tag (e.g. \"v1.0.2\"). Aborting." + end + + version = tag.sub(/^v/, '') + gem = "gitaly-#{version}.gem" abort "gem not found: #{gem}" unless File.exist?(gem) puts "Proceed to publish version #{tag}? Enter 'Yes' to continue; Ctrl-C to abort" @@ -28,6 +33,13 @@ def main(tag) run!(%W[git push origin HEAD #{tag}]) run!(%W[gem push #{gem}]) + + # If this tag is not a patch release, we want a stable branch to be created + return unless version.match?(/\.0\z/) + + stable_branch = "#{version.gsub(/\.0\z/, '').gsub('.', '-')}-stable" + run!(%W[git branch #{stable_branch} #{tag}]) + run!(%W[git push -u origin #{stable_branch}]) end unless ARGV.count == 1 diff --git a/_support/release b/_support/release index fdf83b0a2..00a592bdb 100755 --- a/_support/release +++ b/_support/release @@ -5,7 +5,7 @@ require_relative 'run.rb' def main(version) - unless version =~ /^[0-9]/ + unless version.match?(/\d+\.\d+\.\d+/) abort "Version string #{version.inspect} does not look like a semver (e.g. \"1.0.2\"). Aborting." end |