summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-09-15 07:01:12 +0000
committerBundlerbot <bot@bundler.io>2019-09-15 07:01:12 +0000
commit89b120310fa853ef7980fa7d78a2c61ae3acf9d6 (patch)
tree08ef90f565267b4de004f6b2dfdca7b05b6d7742
parent9295e5df66bfc989bbc5a1c80e24f2233a8ad292 (diff)
parent1780f0cfa9e6b3da395287f7cb58226fcc1a02d8 (diff)
downloadbundler-89b120310fa853ef7980fa7d78a2c61ae3acf9d6.tar.gz
Merge #7355
7355: Restore version bumping to `release:prepare_patch` r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that I removed too much code in #7350. ### What was your diagnosis of the problem? My diagnosis was that since I removed the auto-bumping `version.rb`, the task no longer works before it tries to cherry-pick changes for the _current_, not the _to be released_ version, so I fails because it finds no open PR for that milestone (because it's already been released). ### What is your fix for the problem, implemented in this PR? My fix is to restore the code that automatically bumps the version to the next patch level version, and commits that to the release branch. ### Why did you choose this fix out of the possible options? I chose this fix because it works for me. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--doc/playbooks/RELEASING.md29
-rw-r--r--task/release.rake26
2 files changed, 41 insertions, 14 deletions
diff --git a/doc/playbooks/RELEASING.md b/doc/playbooks/RELEASING.md
index 475a748dcc..8178f2f925 100644
--- a/doc/playbooks/RELEASING.md
+++ b/doc/playbooks/RELEASING.md
@@ -48,7 +48,8 @@ using:
$ git cherry-pick -m 1 dd6aef9
```
-The `rake release:patch` command will automatically handle cherry-picking, and is further detailed below.
+The `rake release:prepare_patch` command will automatically handle
+cherry-picking, and is further detailed below.
## Changelog
@@ -128,16 +129,22 @@ per bug fixed. Then run `rake release` from the `-stable` branch,
and pour yourself a tasty drink!
PRs containing regression fixes for a patch release of the current minor version
-are merged to master. These commits are then cherry-picked from master onto the
-minor branch (`1-12-stable`).
-
-There is a `rake release:patch` rake task that automates creating a patch release.
-It takes a single argument, the _exact_ patch release being made (e.g. `1.12.3`),
-and checks out the appropriate stable branch (`1-12-stable`), grabs the `1.12.3`
-milestone from GitHub, ensures all PRs are closed, and then cherry-picks those changes
-(and only those changes) to the stable branch. The task then bumps the version in the
-version file, prompts you to update the `CHANGELOG.md`, then will commit those changes
-and run `rake release`!
+are merged to master. These commits need to be cherry-picked from master onto
+the minor branch (`1-12-stable`).
+
+There is a `rake release:prepare_patch` rake task that helps with creating a patch
+release. It takes a single argument, the _exact_ patch release being made (e.g.
+`1.12.3`), but if not given it will bump the tiny version number by one. This
+task checks out the appropriate stable branch (`1-12-stable`), grabs the
+`1.12.3` milestone from GitHub, ensures all PRs are closed, and then
+cherry-picks those changes (and only those changes) to a new branch based off
+the stable branch. Then bumps the version in the version file and commits that
+change on top of the cherry-picks.
+
+Now you have a release branch ready to be merged into the stable branch. You'll
+want to open a PR from this branch into the stable branch and provided CI is
+green, you can go ahead, merge the PR and run `rake release` from the updated
+stable branch.
## Beta testing
diff --git a/task/release.rake b/task/release.rake
index 65283f0750..be0241bffb 100644
--- a/task/release.rake
+++ b/task/release.rake
@@ -144,10 +144,21 @@ namespace :release do
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
+ task :prepare_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
- puts "Cherry-picking PRs milestoned for #{version} into the stable branch..."
+ puts "Cherry-picking PRs milestoned for #{version} (currently #{bundler_spec.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 }
@@ -173,6 +184,15 @@ namespace :release do
warn "Opening a new shell to fix the cherry-pick errors"
abort unless system("zsh")
end
+
+ 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", "commit", "-am", "Version #{version}")
end
desc "Open all PRs that have not been included in a stable release"