summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-09-12 07:54:24 +0000
committerBundlerbot <bot@bundler.io>2019-09-12 07:54:24 +0000
commit9295e5df66bfc989bbc5a1c80e24f2233a8ad292 (patch)
tree993b2fa1869740ae814fcee5b954f40316b33284
parentf7de5df5910d5bea9de22536b7f7f646fed30f6f (diff)
parent5057e5e55cfd8ecc20f124bda03650ff7a20f256 (diff)
downloadbundler-9295e5df66bfc989bbc5a1c80e24f2233a8ad292.tar.gz
Merge #7350
7350: Simplify `release:patch` task r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that I'm using a slightly different workflow for releasing, but the current rake task does not work my way. ### What was your diagnosis of the problem? My diagnosis was that previously the release task would push the changelog directly to the release branch and master. The way I'm doing it, I open a regular PR which can be reviewed and merged through bundlerbot just like any other PR. ### What is your fix for the problem, implemented in this PR? My fix is to adapt the task to the workflow I'm using, and change it to only cherry-pick all the milestoned changes to the stable branch. I renamed it to `release:prepare_patch`. ### Why did you choose this fix out of the possible options? I chose this fix because it allows the release process itself to be reviewed, and it would allow us to protect the master and stable branches if we wanted to. It also allows to make sure that CI is passing on the stable branch with all changes cherry-picked, before actually releasing. This could avoid, for example, bugs from being introduced from conflict-resolution errors while cherry-picking changes. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--task/release.rake43
1 files changed, 5 insertions, 38 deletions
diff --git a/task/release.rake b/task/release.rake
index f5573eac5e..65283f0750 100644
--- a/task/release.rake
+++ b/task/release.rake
@@ -143,22 +143,11 @@ namespace :release do
}
end
- desc "Make a patch release with the PRs from master in the patch milestone"
- task :patch, :version do |_t, args|
- version = args.version
-
- version ||= begin
- version = bundler_spec.version
- segments = version.segments
- if segments.last.is_a?(String)
- segments << "1"
- else
- segments[-1] += 1
- end
- segments.join(".")
- end
+ desc "Prepare a patch release with the PRs from master in the patch milestone"
+ task :prepare_patch do
+ version = bundler_spec.version.to_s
- confirm "You are about to release #{version}, currently #{bundler_spec.version}"
+ puts "Cherry-picking PRs milestoned for #{version} into the stable branch..."
milestones = gh_api_request(:path => "repos/bundler/bundler/milestones?state=open")
unless patch_milestone = milestones.find {|m| m["title"] == version }
@@ -172,17 +161,8 @@ namespace :release do
end
prs.compact!
- bundler_spec.version = version
-
branch = version.split(".", 3)[0, 2].push("stable").join("-")
- sh("git", "checkout", branch)
-
- version_file = "lib/bundler/version.rb"
- version_contents = File.read(version_file)
- unless version_contents.sub!(/^(\s*VERSION = )"#{Gem::Version::VERSION_PATTERN}"/, "\\1#{version.to_s.dump}")
- abort "failed to update #{version_file}, is it in the expected format?"
- end
- File.open(version_file, "w") {|f| f.write(version_contents) }
+ sh("git", "checkout", "-b", "release/#{version}", branch)
commits = `git log --oneline origin/master --`.split("\n").map {|l| l.split(/\s/, 2) }.reverse
commits.select! {|_sha, message| message =~ /(Auto merge of|Merge pull request|Merge) ##{Regexp.union(*prs)}/ }
@@ -193,19 +173,6 @@ namespace :release do
warn "Opening a new shell to fix the cherry-pick errors"
abort unless system("zsh")
end
-
- prs.each do |pr|
- system("open", "https://github.com/bundler/bundler/pull/#{pr}")
- confirm "Add to the changelog"
- end
-
- confirm "Update changelog"
- sh("git", "commit", "-am", "Version #{version} with changelog")
- sh("rake", "release")
- sh("git", "checkout", "master")
- sh("git", "pull")
- sh("git", "merge", "v#{version}", "--no-edit")
- sh("git", "push")
end
desc "Open all PRs that have not been included in a stable release"