diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-05-06 14:20:21 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-05-06 14:20:21 +0300 |
commit | 664e472393e6b687777ef42a5a34ffd02e04ed08 (patch) | |
tree | af418ea98014bc31ac4e62e34c2bfa3cea3fb195 | |
parent | 930e8103e55f6914b8ccfdd1d2a88bd21421fa0f (diff) | |
parent | bb8c715f088a1bcd4e3b7771f13d68c86f5230f8 (diff) |
Merge branch 'jv-release-publish' into 'master'
Split out the "publish" step from _support/release
See merge request gitlab-org/gitaly!1231
-rwxr-xr-x | _support/publish | 34 | ||||
-rwxr-xr-x | _support/release | 21 |
2 files changed, 35 insertions, 20 deletions
diff --git a/_support/publish b/_support/publish new file mode 100755 index 000000000..76ca456f7 --- /dev/null +++ b/_support/publish @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby + +require_relative 'run.rb' + +REMOTE_REGEX = %r{gitlab.com.gitlab-org/gitaly.git} + +# Sanity check +%w[ + git@gitlab.com:gitlab-org/gitaly.git + https://gitlab.com/gitlab-org/gitaly.git + https://janedoe@gitlab.com/gitlab-org/gitaly.git +].each do |remote| + abort "regex check failed failed for #{remote.inspect}" unless REMOTE_REGEX.match(remote) +end + +def main(tag) + remote = capture!(%w[git remote get-url --push origin]) + unless REMOTE_REGEX.match(remote) + abort "Git remote 'origin' must match #{REMOTE_REGEX}, got #{remote.inspect}" + end + + puts "Proceed to publish version #{tag}? Enter 'Yes' to continue; Ctrl-C to abort" + $stdout.flush + abort unless $stdin.gets.chomp == 'Yes' + + run!(%W[git push origin HEAD #{tag}]) +end + +unless ARGV.count == 1 + warn "Usage: #{$0} TAG" + abort +end + +main(ARGV[0]) diff --git a/_support/release b/_support/release index 2ff2061e0..443f013e8 100755 --- a/_support/release +++ b/_support/release @@ -3,23 +3,8 @@ require 'erb' require_relative 'run.rb' -REMOTE_REGEX = %r{gitlab.com.gitlab-org/gitaly.git} - -# Sanity check -%w[ - git@gitlab.com:gitlab-org/gitaly.git - https://gitlab.com/gitlab-org/gitaly.git - https://janedoe@gitlab.com/gitlab-org/gitaly.git -].each do |remote| - abort "regex check failed failed for #{remote.inspect}" unless REMOTE_REGEX.match(remote) -end def main(version) - remote = capture!(%w[git remote get-url --push origin]) - unless REMOTE_REGEX.match(remote) - abort "Git remote 'origin' must match #{REMOTE_REGEX}, got #{remote.inspect}" - end - unless version =~ /^[0-9]/ abort "Version string #{version.inspect} does not look like a semver (e.g. \"1.0.2\"). Aborting." end @@ -47,11 +32,7 @@ def main(version) show_output = capture!(%W[git show --pretty #{tag_name}]) puts show_output - puts "Proceed to publish version #{version}? Enter 'Yes' to continue; Ctrl-C to abort" - $stdout.flush - abort unless $stdin.gets.chomp == 'Yes' - - run!(%W[git push origin HEAD #{tag_name}]) + puts "If this is not a security release you can now publish this tag to gitlab.com:\n\n\t_support/publish #{tag_name}\n\n" end def write_version_file(version) |