rbs 4.1.1.pre.1-java → 4.1.2.dev.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/release-gems.yml +106 -35
- data/CHANGELOG.md +9 -1
- data/Rakefile +136 -34
- data/docs/release.md +53 -22
- data/lib/rbs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5ff0fefb724347b7afc8fc65763c4ba16414b8b2497852d5efae5b6672f16f61
|
|
4
|
+
data.tar.gz: cba1eb372baf8f94c2040860c777ec50b5cd38d638ffb4114c04aacc33530b6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aaff2d5a84062efef49501de2bd58efa2715862c45894c29ebd31d3ecf95e7000eba18623ecaf104b7f1f862e899d3c23dd6e8fb38340ab2e3337756f9f27733
|
|
7
|
+
data.tar.gz: e98f7df393b850c15eb401cf8f178e93030df4bcdd056d3cacafc0daf810cee56ff7627ae856039278a49e03a55e27e82a65c3fefb295617abd828abcc5ff630
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
name: Release gems
|
|
2
2
|
|
|
3
|
-
# Builds, publishes, and announces a release. Dispatch it
|
|
4
|
-
#
|
|
5
|
-
# traces back to an immutable ref, and so the reversible step comes before the
|
|
6
|
-
# irreversible one.
|
|
3
|
+
# Builds, publishes, and announces a release. Dispatch it with the commit being
|
|
4
|
+
# released and the version that commit declares.
|
|
7
5
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
6
|
+
# Everything is built from `commit`, not from wherever the default branch happens to
|
|
7
|
+
# be when the run starts, so the release describes a state that is already immutable.
|
|
8
|
+
# `version` is the same fact stated a second time -- the run stops before anything is
|
|
9
|
+
# built unless it matches the `RBS::VERSION` of that commit, so dispatching the wrong
|
|
10
|
+
# commit, or the right one under the wrong name, is a failed run rather than a gem
|
|
11
|
+
# that has to be yanked.
|
|
12
|
+
#
|
|
13
|
+
# `dry_run` builds and checks both gems and stops before the tag, which is how the
|
|
14
|
+
# build is exercised without releasing anything.
|
|
10
15
|
#
|
|
11
16
|
# | Gem | Platform | Parser |
|
|
12
17
|
# | -------------------- | ------------- | -------------------------------- |
|
|
@@ -19,11 +24,26 @@ name: Release gems
|
|
|
19
24
|
#
|
|
20
25
|
# One job on purpose. Tagging, pushing the gems, and opening the GitHub release
|
|
21
26
|
# all belong to a single release, and keeping them in one place keeps their order
|
|
22
|
-
# readable -- the tag is created
|
|
23
|
-
# step comes before the irreversible
|
|
27
|
+
# readable -- the tag is created once both gems are known to build and run, and
|
|
28
|
+
# before anything is published, so the reversible step comes before the irreversible
|
|
29
|
+
# one.
|
|
30
|
+
#
|
|
31
|
+
# The file name is what the RubyGems trusted publisher for `rbs` is registered
|
|
32
|
+
# against, so it cannot be renamed without registering the new name first.
|
|
24
33
|
|
|
25
34
|
on:
|
|
26
35
|
workflow_dispatch:
|
|
36
|
+
inputs:
|
|
37
|
+
commit:
|
|
38
|
+
description: "Commit to release, as a full 40-character SHA"
|
|
39
|
+
required: true
|
|
40
|
+
version:
|
|
41
|
+
description: "Version to release, without the leading `v` (e.g. `4.1.2`)"
|
|
42
|
+
required: true
|
|
43
|
+
dry_run:
|
|
44
|
+
description: "Build and check the gems without tagging or publishing anything"
|
|
45
|
+
type: boolean
|
|
46
|
+
default: false
|
|
27
47
|
|
|
28
48
|
permissions:
|
|
29
49
|
contents: read
|
|
@@ -38,12 +58,60 @@ jobs:
|
|
|
38
58
|
name: release
|
|
39
59
|
runs-on: ubuntu-latest
|
|
40
60
|
permissions:
|
|
41
|
-
contents: write # publish the GitHub release
|
|
61
|
+
contents: write # push the tag, publish the GitHub release
|
|
42
62
|
id-token: write # trusted publishing to RubyGems
|
|
63
|
+
env:
|
|
64
|
+
# The inputs are read through the environment rather than interpolated into
|
|
65
|
+
# the scripts below.
|
|
66
|
+
COMMIT: ${{ inputs.commit }}
|
|
67
|
+
VERSION: ${{ inputs.version }}
|
|
68
|
+
TAG: v${{ inputs.version }}
|
|
43
69
|
steps:
|
|
44
70
|
# The gemspec takes its file list from `git ls-files`, so both gems are built
|
|
45
|
-
# from the committed state
|
|
71
|
+
# from the committed state -- of the dispatched commit, since that is what is
|
|
72
|
+
# checked out. The full history is needed to tell which branches contain it.
|
|
46
73
|
- uses: actions/checkout@v7
|
|
74
|
+
with:
|
|
75
|
+
ref: ${{ inputs.commit }}
|
|
76
|
+
fetch-depth: 0
|
|
77
|
+
|
|
78
|
+
# Before anything is installed or built: these are the two things the release
|
|
79
|
+
# is named after and built from, and a mistake in either is cheapest to catch
|
|
80
|
+
# here.
|
|
81
|
+
- name: Check the inputs
|
|
82
|
+
run: |
|
|
83
|
+
if [[ ! "$COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
|
|
84
|
+
echo "::error::\`$COMMIT\` is not a full 40-character SHA. A release names one exact commit."
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
if [[ ! "$VERSION" =~ ^[0-9][0-9a-zA-Z.]*$ ]]; then
|
|
88
|
+
echo "::error::\`$VERSION\` is not a version number. Pass it without the leading \`v\`."
|
|
89
|
+
exit 1
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# A release proper is cut from the default branch, while a patch release can
|
|
93
|
+
# be cut from a release branch, so which branch the commit is on is not this
|
|
94
|
+
# workflow's business. That it is on one is: a commit no branch contains is
|
|
95
|
+
# one that nothing in the repository leads to any more.
|
|
96
|
+
git fetch --no-tags origin "+refs/heads/*:refs/remotes/origin/*"
|
|
97
|
+
branches=$(git branch --remotes --contains "$COMMIT" --format "%(refname:lstrip=3)")
|
|
98
|
+
if [ -z "$branches" ]; then
|
|
99
|
+
echo "::error::$COMMIT is not on any branch."
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
echo "Branches containing $COMMIT:"
|
|
103
|
+
printf '%s\n' "$branches"
|
|
104
|
+
|
|
105
|
+
# A tag that already exists is a version that has already been released, and
|
|
106
|
+
# pushing it would fail after the build rather than before it.
|
|
107
|
+
- name: Check that the tag does not exist
|
|
108
|
+
if: ${{ !inputs.dry_run }}
|
|
109
|
+
run: |
|
|
110
|
+
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null; then
|
|
111
|
+
echo "::error::$TAG already exists, so $VERSION has been released."
|
|
112
|
+
exit 1
|
|
113
|
+
fi
|
|
114
|
+
|
|
47
115
|
- name: Set up Ruby
|
|
48
116
|
uses: ruby/setup-ruby@v1
|
|
49
117
|
with:
|
|
@@ -56,25 +124,16 @@ jobs:
|
|
|
56
124
|
bundle config set --local without libs:profilers
|
|
57
125
|
bundle install --jobs 4 --retry 3
|
|
58
126
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# the tag is what the release is named after, so it has to be the version the
|
|
65
|
-
# tagged commit actually declares.
|
|
66
|
-
- name: Check the tag against RBS::VERSION
|
|
67
|
-
if: github.ref_type == 'tag'
|
|
68
|
-
run: |
|
|
69
|
-
if [ "${{ github.ref_name }}" != "v${{ steps.version.outputs.version }}" ]; then
|
|
70
|
-
echo "::error::tag ${{ github.ref_name }} does not match RBS::VERSION ${{ steps.version.outputs.version }}"
|
|
71
|
-
exit 1
|
|
72
|
-
fi
|
|
127
|
+
# Fails before a minute is spent on the build, and before anything is pushed:
|
|
128
|
+
# the version has to be the one the released commit declares, and -- unless
|
|
129
|
+
# this is a `.dev.N` release -- the one CHANGELOG.md is written up for.
|
|
130
|
+
- name: Check the version and the changelog
|
|
131
|
+
run: bundle exec rake "gem:check_release[$VERSION]"
|
|
73
132
|
|
|
74
133
|
- name: Build the ruby gem
|
|
75
134
|
run: |
|
|
76
135
|
mkdir -p pkg
|
|
77
|
-
gem build rbs.gemspec -o "pkg/rbs-$
|
|
136
|
+
gem build rbs.gemspec -o "pkg/rbs-$VERSION.gem"
|
|
78
137
|
|
|
79
138
|
# `rake wasm:jruby_setup` compiles src/**/*.c to WebAssembly and copies the
|
|
80
139
|
# result to lib/rbs/wasm/, where the gemspec picks it up. clang runs as a
|
|
@@ -91,7 +150,7 @@ jobs:
|
|
|
91
150
|
- name: Build the java gem
|
|
92
151
|
env:
|
|
93
152
|
RBS_PLATFORM: java
|
|
94
|
-
run: gem build rbs.gemspec -o "pkg/rbs-$
|
|
153
|
+
run: gem build rbs.gemspec -o "pkg/rbs-$VERSION-java.gem"
|
|
95
154
|
|
|
96
155
|
# `git ls-files` vouches for everything else, but rbs_parser.wasm is a build
|
|
97
156
|
# artifact, so the java gem is the one that can come out quietly wrong.
|
|
@@ -108,8 +167,7 @@ jobs:
|
|
|
108
167
|
raise "the java gem must not declare an extension" unless java_gem.extensions.empty?
|
|
109
168
|
|
|
110
169
|
[ruby_gem, java_gem].each { puts "#{_1.full_name}: #{_1.files.size} files" }
|
|
111
|
-
' "pkg/rbs-$
|
|
112
|
-
"pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
|
|
170
|
+
' "pkg/rbs-$VERSION.gem" "pkg/rbs-$VERSION-java.gem"
|
|
113
171
|
|
|
114
172
|
# The checks above cannot tell whether rbs_parser.wasm actually runs. Install
|
|
115
173
|
# the gem the way a user would -- jar-dependencies fetches Chicory and ASM
|
|
@@ -122,7 +180,7 @@ jobs:
|
|
|
122
180
|
bundler: none
|
|
123
181
|
- name: Check the java gem on JRuby
|
|
124
182
|
run: |
|
|
125
|
-
gem install "pkg/rbs-$
|
|
183
|
+
gem install "pkg/rbs-$VERSION-java.gem"
|
|
126
184
|
ruby -e '
|
|
127
185
|
require "rbs"
|
|
128
186
|
_, _, decls = RBS::Parser.parse_signature("class Foo end")
|
|
@@ -138,27 +196,40 @@ jobs:
|
|
|
138
196
|
bundler: none
|
|
139
197
|
|
|
140
198
|
# Uploaded before publishing, so a failed push still leaves the gems behind.
|
|
199
|
+
# This is also where a dry run ends.
|
|
141
200
|
- uses: actions/upload-artifact@v7
|
|
142
201
|
with:
|
|
143
202
|
name: gems
|
|
144
203
|
path: pkg/*.gem
|
|
145
204
|
if-no-files-found: error
|
|
146
205
|
|
|
147
|
-
# Everything below runs only for a release
|
|
206
|
+
# Everything below runs only for a real release.
|
|
207
|
+
|
|
208
|
+
# The tag comes after the gems are known to build and run, and before anything
|
|
209
|
+
# is published: a tag can be deleted, while a version pushed to RubyGems can
|
|
210
|
+
# only be yanked. What it names was decided by the checkout rather than by the
|
|
211
|
+
# tagging, so nothing rests on it being created first.
|
|
212
|
+
- name: Tag the release
|
|
213
|
+
if: ${{ !inputs.dry_run }}
|
|
214
|
+
run: |
|
|
215
|
+
git config user.name "github-actions[bot]"
|
|
216
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
217
|
+
bundle exec rake gem:tag
|
|
218
|
+
|
|
148
219
|
- name: Configure RubyGems credentials
|
|
149
|
-
if:
|
|
220
|
+
if: ${{ !inputs.dry_run }}
|
|
150
221
|
# No floating major tag on this action, so the exact release is pinned.
|
|
151
222
|
uses: rubygems/configure-rubygems-credentials@v2.1.0
|
|
152
223
|
|
|
153
224
|
- name: Push the gems
|
|
154
|
-
if:
|
|
225
|
+
if: ${{ !inputs.dry_run }}
|
|
155
226
|
run: |
|
|
156
|
-
gem push "pkg/rbs-$
|
|
157
|
-
gem push "pkg/rbs-$
|
|
227
|
+
gem push "pkg/rbs-$VERSION.gem"
|
|
228
|
+
gem push "pkg/rbs-$VERSION-java.gem"
|
|
158
229
|
|
|
159
230
|
# Last, so that a failed push never announces a release that has no gems.
|
|
160
231
|
- name: Publish the GitHub release
|
|
161
|
-
if:
|
|
232
|
+
if: ${{ !inputs.dry_run }}
|
|
162
233
|
env:
|
|
163
234
|
GH_TOKEN: ${{ github.token }}
|
|
164
235
|
run: bundle exec rake gem:gh_release
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
## 4.1.1
|
|
3
|
+
## 4.1.1 (2026-07-30)
|
|
4
4
|
|
|
5
5
|
### Library changes
|
|
6
6
|
|
|
@@ -99,6 +99,14 @@ This release also introduces `RBS::Rewriter`, an API to edit RBS source text whi
|
|
|
99
99
|
* ci: skip Gemfile.lock BUNDLED WITH on ruby-head ([#2952](https://github.com/ruby/rbs/pull/2952))
|
|
100
100
|
* Remove `logger` from sig dependencies ([#2904](https://github.com/ruby/rbs/pull/2904))
|
|
101
101
|
|
|
102
|
+
## 4.0.3 (2026-06-18)
|
|
103
|
+
|
|
104
|
+
### Miscellaneous
|
|
105
|
+
|
|
106
|
+
* Fix Ruby CI failure with compressed `Zlib::GzipReader` test fixtures. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
107
|
+
* Fix flaky `DirSingletonTest#test_fchdir` and `DirSingletonTest#test_for_fd` under aggressive GC. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
108
|
+
* Fix Ruby head CI failure caused by the lockfile-pinned Bundler version. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
109
|
+
|
|
102
110
|
## 4.0.2 (2026-03-25)
|
|
103
111
|
|
|
104
112
|
### Library changes
|
data/Rakefile
CHANGED
|
@@ -594,20 +594,54 @@ def changelog_commits(from, paths: [])
|
|
|
594
594
|
output.lines.map(&:chomp).reject(&:empty?)
|
|
595
595
|
end
|
|
596
596
|
|
|
597
|
-
#
|
|
597
|
+
# What `git cherry-pick -x` appends to the message of the commit it creates.
|
|
598
|
+
CHERRY_PICK_ORIGIN = /^\(cherry picked from commit ([0-9a-f]{40})\)$/
|
|
599
|
+
|
|
600
|
+
# Maps the commits that record where they were cherry-picked from to that commit.
|
|
598
601
|
#
|
|
599
|
-
#
|
|
602
|
+
# A backport is a cherry-pick, so on a release branch it is the recorded origin, not the commit
|
|
603
|
+
# itself, that leads to the pull request the change was written and reviewed in. Without this a
|
|
604
|
+
# backported change is attributed to the pull request that carried the backport, which says
|
|
605
|
+
# nothing about the change and is the same for every commit it brought over.
|
|
600
606
|
#
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
607
|
+
# A commit backported twice -- the development line, then a release branch -- carries one line
|
|
608
|
+
# per hop, appended in order, so the first one is where the change started.
|
|
609
|
+
#
|
|
610
|
+
def changelog_origins(commits)
|
|
611
|
+
return {} if commits.empty?
|
|
612
|
+
|
|
613
|
+
require "open3"
|
|
614
|
+
|
|
615
|
+
# `--no-walk` prints these commits and nothing else. NUL delimiters keep a commit message --
|
|
616
|
+
# which can contain anything, including what this format looks like -- from being read as the
|
|
617
|
+
# format itself.
|
|
618
|
+
output, status = Open3.capture2("git", "log", "--no-walk", "--format=%H%x00%B%x00", *commits, binmode: true)
|
|
619
|
+
raise status.inspect unless status.success?
|
|
620
|
+
|
|
621
|
+
# Commit messages are UTF-8, while the default external encoding follows the locale. Without
|
|
622
|
+
# this, splitting a message that is not ASCII fails under `LANG=C`, as in GitHub Actions.
|
|
623
|
+
output.force_encoding(Encoding::UTF_8)
|
|
624
|
+
|
|
625
|
+
output.split("\0").each_slice(2).each_with_object({}) do |(commit, message), origins|
|
|
626
|
+
commit = commit.to_s.strip
|
|
627
|
+
next if commit.empty?
|
|
628
|
+
|
|
629
|
+
origin = message.to_s[CHERRY_PICK_ORIGIN, 1] or next
|
|
630
|
+
origins[commit] = origin
|
|
631
|
+
end
|
|
632
|
+
end
|
|
604
633
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
634
|
+
# Asks GitHub which pull requests each commit came from, so that any merge strategy -- merge
|
|
635
|
+
# commit, squash, or rebase -- is handled without parsing commit messages.
|
|
636
|
+
#
|
|
637
|
+
# Returns `{ oid => [pull request, ...] }`, with an empty array for the commits GitHub has no
|
|
638
|
+
# merged pull request for, including the ones it does not know at all.
|
|
639
|
+
#
|
|
640
|
+
def changelog_associated_pull_requests(oids)
|
|
641
|
+
oids.uniq.each_slice(50).each_with_object({}) do |slice, found|
|
|
642
|
+
aliases = slice.map.with_index do |oid, index|
|
|
609
643
|
<<~GRAPHQL
|
|
610
|
-
c#{index}: object(oid: "#{
|
|
644
|
+
c#{index}: object(oid: "#{oid}") {
|
|
611
645
|
... on Commit {
|
|
612
646
|
associatedPullRequests(first: 10) {
|
|
613
647
|
nodes {
|
|
@@ -620,18 +654,44 @@ def changelog_pull_requests(commits, skip_labels: CHANGELOG_SKIP_LABELS)
|
|
|
620
654
|
GRAPHQL
|
|
621
655
|
end
|
|
622
656
|
|
|
623
|
-
changelog_graphql(aliases.join("\n"))
|
|
624
|
-
next unless commit
|
|
657
|
+
response = changelog_graphql(aliases.join("\n"))
|
|
625
658
|
|
|
626
|
-
|
|
627
|
-
|
|
659
|
+
slice.each_with_index do |oid, index|
|
|
660
|
+
nodes = response.dig(:"c#{index}", :associatedPullRequests, :nodes) || []
|
|
628
661
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
662
|
+
found[oid] = nodes.select { |pr| pr[:merged] }.map do |pr|
|
|
663
|
+
{ number: pr[:number], title: pr[:title], url: pr[:url], labels: pr.dig(:labels, :nodes).map { |label| label[:name] } }
|
|
664
|
+
end
|
|
665
|
+
end
|
|
666
|
+
end
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
# Finds the pull requests the commits came from, keeping the order of `commits`.
|
|
670
|
+
#
|
|
671
|
+
# Returns the pull requests for the changelog and the ones omitted by `skip_labels`.
|
|
672
|
+
#
|
|
673
|
+
def changelog_pull_requests(commits, skip_labels: CHANGELOG_SKIP_LABELS)
|
|
674
|
+
origins = changelog_origins(commits)
|
|
675
|
+
found = changelog_associated_pull_requests(commits.map { |commit| origins[commit] || commit })
|
|
676
|
+
|
|
677
|
+
# An origin that leads nowhere -- a commit cherry-picked from a fork, or one that went to the
|
|
678
|
+
# default branch without a pull request -- falls back to the commit in this history, which is
|
|
679
|
+
# at least the backport that brought it here.
|
|
680
|
+
fallbacks = commits.select { |commit| origins[commit] && found.fetch(origins[commit], []).empty? }
|
|
681
|
+
found.update(changelog_associated_pull_requests(fallbacks)) unless fallbacks.empty?
|
|
682
|
+
|
|
683
|
+
pull_requests = {}
|
|
684
|
+
skipped = {}
|
|
685
|
+
|
|
686
|
+
commits.each do |commit|
|
|
687
|
+
prs = found.fetch(origins[commit] || commit, [])
|
|
688
|
+
prs = found.fetch(commit, []) if prs.empty?
|
|
689
|
+
|
|
690
|
+
prs.each do |pr|
|
|
691
|
+
if (pr[:labels] & skip_labels).empty?
|
|
692
|
+
pull_requests[pr[:number]] ||= pr
|
|
693
|
+
else
|
|
694
|
+
skipped[pr[:number]] ||= pr
|
|
635
695
|
end
|
|
636
696
|
end
|
|
637
697
|
end
|
|
@@ -779,6 +839,60 @@ namespace :gem do
|
|
|
779
839
|
end
|
|
780
840
|
end
|
|
781
841
|
|
|
842
|
+
# There are three kinds of release: `X.Y.Z`, `X.Y.Z.pre.N`, and `X.Y.Z.dev.N`. The
|
|
843
|
+
# `.dev.N` ones are cut from the development line for people who need a specific
|
|
844
|
+
# change early; they are not written up in the changelog, so there are no notes to
|
|
845
|
+
# publish and nothing worth announcing.
|
|
846
|
+
def dev_release?(version)
|
|
847
|
+
Gem::Version.new(version).segments.include?("dev")
|
|
848
|
+
end
|
|
849
|
+
|
|
850
|
+
# The body of the topmost section of CHANGELOG.md, which is the release being
|
|
851
|
+
# prepared, minus its own heading.
|
|
852
|
+
#
|
|
853
|
+
# The encoding is explicit because the default external encoding follows the
|
|
854
|
+
# locale, and the changelog is not ASCII.
|
|
855
|
+
#
|
|
856
|
+
def changelog_section(version)
|
|
857
|
+
content = File.read(File.join(__dir__, "CHANGELOG.md"), encoding: Encoding::UTF_8)
|
|
858
|
+
section = content.scan(/^## \d.*?(?=^## \d)/m)[0] or raise "🚨 Cannot find a release section in CHANGELOG.md"
|
|
859
|
+
heading, _, body = section.partition("\n")
|
|
860
|
+
heading.include?(version) or raise "🚨 CHANGELOG.md starts with `#{heading.strip}`, which is not #{version}"
|
|
861
|
+
body.strip
|
|
862
|
+
end
|
|
863
|
+
|
|
864
|
+
desc "Check that the working tree is ready to be released as the given version"
|
|
865
|
+
task :check_release, [:version] do |_task, args|
|
|
866
|
+
version = args[:version] or raise "🚨 Pass the version being released: `rake 'gem:check_release[4.1.2]'`"
|
|
867
|
+
Gem::Version.correct?(version) or raise "🚨 `#{version}` is not a version number."
|
|
868
|
+
|
|
869
|
+
# The version being released and the version the commit declares are stated
|
|
870
|
+
# separately -- one by whoever starts the release, one by the commit itself --
|
|
871
|
+
# so that releasing the wrong commit, or releasing the right one under the wrong
|
|
872
|
+
# name, fails here rather than on RubyGems.
|
|
873
|
+
version == RBS::VERSION or
|
|
874
|
+
raise "🚨 Releasing #{version}, but this commit declares `RBS::VERSION = #{RBS::VERSION.inspect}`."
|
|
875
|
+
|
|
876
|
+
if dev_release?(version)
|
|
877
|
+
puts "✅ #{version} is the version of this commit. It is a dev release, so CHANGELOG.md is not checked."
|
|
878
|
+
else
|
|
879
|
+
changelog_section(version)
|
|
880
|
+
puts "✅ #{version} is the version of this commit, and CHANGELOG.md documents it."
|
|
881
|
+
end
|
|
882
|
+
end
|
|
883
|
+
|
|
884
|
+
desc "Create and push the `vX.Y.Z` tag for RBS::VERSION"
|
|
885
|
+
task :tag do
|
|
886
|
+
tag = "v#{RBS::VERSION}"
|
|
887
|
+
|
|
888
|
+
# Annotated, so that the tag carries its own author and date rather than
|
|
889
|
+
# borrowing the tagged commit's.
|
|
890
|
+
sh "git", "tag", "--annotate", "--message", "RBS #{RBS::VERSION}", tag
|
|
891
|
+
sh "git", "push", "origin", tag
|
|
892
|
+
|
|
893
|
+
puts "🏷️ Pushed #{tag}."
|
|
894
|
+
end
|
|
895
|
+
|
|
782
896
|
desc "Publish the GitHub release for RBS::VERSION, unless it is a `.dev.` version"
|
|
783
897
|
task :gh_release do
|
|
784
898
|
require "open3"
|
|
@@ -787,11 +901,7 @@ namespace :gem do
|
|
|
787
901
|
major, minor, *_ = RBS::VERSION.split(".")
|
|
788
902
|
tag = "v#{RBS::VERSION}"
|
|
789
903
|
|
|
790
|
-
|
|
791
|
-
# The `.dev.N` ones are cut from the development line for people who need a
|
|
792
|
-
# specific change early; they are not written up in the changelog, so there are
|
|
793
|
-
# no notes to publish and nothing worth announcing.
|
|
794
|
-
if version.segments.include?("dev")
|
|
904
|
+
if dev_release?(RBS::VERSION)
|
|
795
905
|
puts "⏭️ #{RBS::VERSION} is a dev release, so there is no GitHub release to publish."
|
|
796
906
|
next
|
|
797
907
|
end
|
|
@@ -801,18 +911,10 @@ namespace :gem do
|
|
|
801
911
|
_, status = Open3.capture2("git", "rev-parse", "--verify", "--quiet", "#{tag}^{commit}")
|
|
802
912
|
raise "🚨 No such tag: `#{tag}`. Tag the release before creating the GitHub release." unless status.success?
|
|
803
913
|
|
|
804
|
-
# The topmost section of the changelog is this release, minus its own heading.
|
|
805
|
-
# The encoding is explicit because the default external encoding follows the
|
|
806
|
-
# locale, and the changelog is not ASCII.
|
|
807
|
-
content = File.read(File.join(__dir__, "CHANGELOG.md"), encoding: Encoding::UTF_8)
|
|
808
|
-
section = content.scan(/^## \d.*?(?=^## \d)/m)[0] or raise "🚨 Cannot find a release section in CHANGELOG.md"
|
|
809
|
-
heading, _, body = section.partition("\n")
|
|
810
|
-
heading.include?(RBS::VERSION) or raise "🚨 CHANGELOG.md starts with `#{heading.strip}`, which is not #{RBS::VERSION}"
|
|
811
|
-
|
|
812
914
|
notes = <<~NOTES
|
|
813
915
|
[Release note](https://github.com/ruby/rbs/wiki/Release-Note-#{major}.#{minor})
|
|
814
916
|
|
|
815
|
-
#{
|
|
917
|
+
#{changelog_section(RBS::VERSION)}
|
|
816
918
|
NOTES
|
|
817
919
|
|
|
818
920
|
# Published rather than drafted: the notes are the changelog section that was
|
data/docs/release.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Releasing RBS
|
|
2
2
|
|
|
3
|
-
A release is a pull request
|
|
4
|
-
|
|
5
|
-
gems` workflow, so nothing has to be built or pushed from a laptop.
|
|
3
|
+
A release is a pull request and one workflow run. Everything that leaves the
|
|
4
|
+
repository — the tag, both gems, and the GitHub release — is produced by the
|
|
5
|
+
`Release gems` workflow, so nothing has to be built or pushed from a laptop.
|
|
6
6
|
|
|
7
7
|
Each release ships **two gems**:
|
|
8
8
|
|
|
@@ -97,26 +97,29 @@ on a small release. Two things scale with the size of the release:
|
|
|
97
97
|
The date is the day the gem is released, matching the `vX.Y.Z` tag — not the day this pull request
|
|
98
98
|
is opened. Fix it up before step 2 if the pull request sat for a few days.
|
|
99
99
|
|
|
100
|
-
### 2.
|
|
100
|
+
### 2. Run the `Release gems` workflow
|
|
101
101
|
|
|
102
|
-
Once the pull request is merged,
|
|
102
|
+
Once the pull request is merged, dispatch
|
|
103
|
+
[`release-gems.yml`](../.github/workflows/release-gems.yml) from the Actions tab with two inputs:
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
```
|
|
105
|
+
| Input | Value |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `commit` | The full 40-character SHA of the merge commit, taken from the merged pull request |
|
|
108
|
+
| `version` | `X.Y.Z`, without the leading `v` |
|
|
109
109
|
|
|
110
|
-
The
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
The ref selector picks which copy of the workflow file runs, not what gets released — leave it on
|
|
111
|
+
`master`. Everything is built from `commit`, so the run is unaffected by whatever lands on `master`
|
|
112
|
+
in the meantime, and a patch release cut from a release branch is dispatched the same way as any
|
|
113
|
+
other: the workflow does not care which branch the commit is on.
|
|
113
114
|
|
|
114
|
-
|
|
115
|
+
The two inputs say the same thing twice, once as a commit and once as a name, and the run stops
|
|
116
|
+
before anything is built unless they agree with each other and with the repository:
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
- `commit` has to be a full SHA that some branch contains,
|
|
119
|
+
- `version` has to be the `RBS::VERSION` that commit declares,
|
|
120
|
+
- CHANGELOG.md has to start with a section for `version` (skipped for `.dev.N`, which is not
|
|
121
|
+
written up),
|
|
122
|
+
- `vX.Y.Z` must not exist yet.
|
|
120
123
|
|
|
121
124
|
It then:
|
|
122
125
|
|
|
@@ -127,14 +130,19 @@ It then:
|
|
|
127
130
|
- installs the `java` gem on JRuby and parses with it, so the WebAssembly runtime is exercised
|
|
128
131
|
before anything is published,
|
|
129
132
|
- uploads both gems as an artifact,
|
|
130
|
-
-
|
|
133
|
+
- tags `commit` as `vX.Y.Z` and pushes the tag,
|
|
134
|
+
- pushes both gems to RubyGems through trusted publishing,
|
|
131
135
|
- publishes the GitHub release with the notes from CHANGELOG.md, skipping this last step for
|
|
132
136
|
`.dev.N` versions.
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
The tag is created once both gems are known to build and run, and before anything is published: a
|
|
139
|
+
tag can be deleted, while a version pushed to RubyGems can only be yanked.
|
|
140
|
+
|
|
141
|
+
Checking the `dry_run` box runs everything up to the artifact and stops — no tag, no gems pushed,
|
|
142
|
+
no release — which is how the build is exercised without releasing. `version` still has to match
|
|
143
|
+
the commit, so a dry run is also how a release is rehearsed before it is cut.
|
|
136
144
|
|
|
137
|
-
###
|
|
145
|
+
### 3. Start the next development cycle
|
|
138
146
|
|
|
139
147
|
Open another pull request setting `RBS::VERSION` to the next prerelease (`4.1.1` → `4.1.2.pre`),
|
|
140
148
|
with `Gemfile.lock` regenerated, labeled `skip-changelog` like the release pull request itself.
|
|
@@ -142,6 +150,21 @@ Without it the version on `master` keeps claiming to be the released version for
|
|
|
142
150
|
development period, and `rake gem:changelog` reads that version to decide where the next changelog
|
|
143
151
|
starts.
|
|
144
152
|
|
|
153
|
+
## Backports
|
|
154
|
+
|
|
155
|
+
A patch release is cut from a release branch (`aaa-X.Y.x`), and what it carries beyond the previous
|
|
156
|
+
release is cherry-picked from the development line. Cherry-pick with `-x`:
|
|
157
|
+
|
|
158
|
+
```console
|
|
159
|
+
$ git cherry-pick -x <commit>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`-x` records the commit the change was copied from, and that recorded line is what `rake
|
|
163
|
+
gem:changelog` follows to reach the pull request the change was written and reviewed in. Without
|
|
164
|
+
it, the only pull request a backported commit is associated with is the one that carried the
|
|
165
|
+
backport, which says nothing about the change and is the same for every commit it brought over —
|
|
166
|
+
that is why the 4.0.3 changelog credits its three entries to the same pull request.
|
|
167
|
+
|
|
145
168
|
## Notes
|
|
146
169
|
|
|
147
170
|
- Prereleases (`X.Y.Z.pre.N`) are only installed with `gem install rbs --pre`;
|
|
@@ -149,3 +172,11 @@ starts.
|
|
|
149
172
|
resolves to the `-java` gem automatically.
|
|
150
173
|
- `Dockerfile.jruby` pins the WASI SDK / Chicory / ASM versions to match the
|
|
151
174
|
`wasm`, `jruby`, and `release-gems` workflows. Keep them in sync when bumping.
|
|
175
|
+
- `rake 'gem:check_release[X.Y.Z]'` and `rake gem:tag` are what the workflow runs to
|
|
176
|
+
check the release and to create the tag. Both work locally, which is the fallback
|
|
177
|
+
if the tag ever has to be created by hand.
|
|
178
|
+
- Those two tasks and `rake gem:gh_release` come from the Rakefile of the commit
|
|
179
|
+
being released, not from the branch the workflow was dispatched from. Releasing
|
|
180
|
+
from a release branch (`aaa-X.Y.x`) therefore needs the release tooling on that
|
|
181
|
+
branch as well; without it the run fails on the missing task, before publishing
|
|
182
|
+
anything.
|
data/lib/rbs/version.rb
CHANGED