Skip to content

Commit e02c839

Browse files
Merge pull request #5898 from rubygems/better-releases
Small improvements to the release process
2 parents 763b4c5 + 7bca8e5 commit e02c839

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

POLICIES.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,19 @@ at version 2.7, so when RubyGems 2.8 is released, it will only support Ruby
4242

4343
## Release Process
4444

45-
Releases of new versions should follow these steps, to ensure the process is
46-
smooth and no needed steps are missed.
45+
### Permissions
46+
47+
You'll need the following environment variables set to release RubyGems &
48+
Bundler:
49+
50+
* AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: to be able to push RubyGems zip
51+
files to s3 so that they appear at RubyGems [download page].
52+
53+
* GITHUB_RELEASE_PAT: A [GitHub PAT] with repo permissions, in order to push
54+
GitHub releases and to use the GitHub API for changelog generation.
55+
56+
[download page]: https://rubygems.org/pages/download
57+
[GitHub PAT]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
4758

4859
### Recommendations for security releases
4960

@@ -54,14 +65,16 @@ smooth and no needed steps are missed.
5465
have to work on weekends.
5566
* Continue with the regular release process below.
5667

57-
5868
### Steps for patch releases
5969

6070
* Confirm all PRs that you want backported are properly tagged with `rubygems:
6171
<type>` or `bundler: <type>` labels at GitHub.
62-
* Run `rake prepare_release[<target_version>]`, create a PR and merge it
63-
to the stable branch once CI passes.
64-
* Switch to the stable branch and pull the PR just merged.
72+
* Run `rake prepare_release[<target_version>]`. This will create a PR to the
73+
stable branch with the backports included in the release, and proper
74+
changelogs and version bumps. It will also create a PR to merge release
75+
changelogs into master.
76+
* Once CI passes, merge the release PR, switch to the stable branch and pull
77+
the PR just merged.
6578
* Release `bundler` with `(cd bundler && bin/rake release)`.
6679
* Release `rubygems` with `rake release`.
6780

bundler/tool/bundler/release_gems.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
source "https://rubygems.org"
44

5-
gem "netrc", "~> 0.11.0"
65
gem "octokit", "~> 4.18"
76
gem "aws-sdk-s3", "~> 1.87"

bundler/tool/bundler/release_gems.rb.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ GEM
4444
faraday-retry (1.0.3)
4545
jmespath (1.5.0)
4646
multipart-post (2.1.1)
47-
netrc (0.11.0)
4847
octokit (4.22.0)
4948
faraday (>= 0.9)
5049
sawyer (~> 0.8.0, >= 0.5.3)
@@ -65,7 +64,6 @@ PLATFORMS
6564

6665
DEPENDENCIES
6766
aws-sdk-s3 (~> 1.87)
68-
netrc (~> 0.11.0)
6967
octokit (~> 4.18)
7068

7169
BUNDLED WITH

util/release.rb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ class Release
66
module GithubAPI
77
def gh_client
88
@gh_client ||= begin
9-
require "netrc"
10-
_username, token = Netrc.read["api.github.com"]
11-
129
require "octokit"
13-
Octokit::Client.new(:access_token => token)
10+
Octokit::Client.new(:access_token => ENV["GITHUB_RELEASE_PAT"])
1411
end
1512
end
1613
end
@@ -187,13 +184,32 @@ def prepare!
187184

188185
return if @level == :minor_or_major
189186

187+
system("git", "push", exception: true)
188+
189+
gh_client.create_pull_request(
190+
"rubygems/rubygems",
191+
@base_branch,
192+
@release_branch,
193+
"Prepare RubyGems #{@rubygems.version} and Bundler #{@bundler.version}",
194+
"It's release day!"
195+
)
196+
190197
system("git", "checkout", "-b", "cherry_pick_changelogs", "master", exception: true)
191198

192199
begin
193200
system("git", "cherry-pick", bundler_changelog, rubygems_changelog, exception: true)
201+
system("git", "push", exception: true)
194202
rescue StandardError
195203
system("git", "cherry-pick", "--abort")
196204
system("git", "branch", "-D", "cherry_pick_changelogs")
205+
else
206+
gh_client.create_pull_request(
207+
"rubygems/rubygems",
208+
"master",
209+
"cherry_pick_changelogs",
210+
"Changelogs for RubyGems #{@rubygems.version} and Bundler #{@bundler.version}",
211+
"Cherry-picking change logs from future RubyGems #{@rubygems.version} and Bundler #{@bundler.version} into master."
212+
)
197213
end
198214
rescue StandardError
199215
system("git", "checkout", initial_branch)

0 commit comments

Comments
 (0)