rbs 4.1.1 → 4.1.2.dev.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0ae1797f25f4639914ed5244dd903aa9bf0cb28d8f7ad46917ea78a5a390c8b
4
- data.tar.gz: 78456ce40939bc2911cf4b70a8053449f34a457fadc35eda478d6e7bec7cc527
3
+ metadata.gz: 0cfab2fcc9f7d7e31709e36fff9cea7838133ed05e13966879cf4a687a6bb5da
4
+ data.tar.gz: a09a2d9083c8c0d20053ace145bcaa5937a90d87023255db008f612124abb07c
5
5
  SHA512:
6
- metadata.gz: b27b18e6a70bf268ecb3db9de38954a733352d643504d1842f9c2dbc9aa4c3af7abf5b9816838a795082061ed3519384e764c31acbce208338cae636481b495a
7
- data.tar.gz: fc7f3b804b4f93e18f71032ff34b19962100c5ca835628cf9d8e44467c96c683c699fb6fe8e0ec895a70c448bf1b21e9f840efd523e295378da9a6a5a42e340f
6
+ metadata.gz: d205a885ddbff819c14e860e694e1759fc31fc5890a111bd49d1addaa44bbc272e8a6ed1e8f8ae6c11074728354342e66db9bf17d957025bfce0df2525050d5f
7
+ data.tar.gz: 8138c49ecaf4c56ca75da1ec7e58e4ca37c2747f42ee8432298f6dcdad628a1085acb522101e8d4bb04dd2419ac8c5ede1475dd7e8610b839ddab82805a6c908
@@ -1,12 +1,17 @@
1
1
  name: Release gems
2
2
 
3
- # Builds, publishes, and announces a release. Dispatch it against the `vX.Y.Z` tag
4
- # of the release: the tag is created first so that everything published afterwards
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
- # Dispatching against a branch builds and verifies the gems and stops there, which
9
- # is how the build is exercised without releasing anything.
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 before anything is published, so the reversible
23
- # step comes before the irreversible one.
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
- - name: Read the version
60
- id: version
61
- run: echo "version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')" >> "$GITHUB_OUTPUT"
62
-
63
- # Fail before spending a minute on the build, and before anything is pushed:
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-${{ steps.version.outputs.version }}.gem"
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-${{ steps.version.outputs.version }}-java.gem"
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-${{ steps.version.outputs.version }}.gem" \
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-${{ steps.version.outputs.version }}-java.gem"
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 tag.
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: github.ref_type == 'tag'
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: github.ref_type == 'tag'
225
+ if: ${{ !inputs.dry_run }}
155
226
  run: |
156
- gem push "pkg/rbs-${{ steps.version.outputs.version }}.gem"
157
- gem push "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
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: github.ref_type == 'tag'
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
@@ -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
- # Finds the pull requests the commits came from, keeping the order of `commits`.
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
- # Returns the pull requests for the changelog and the ones omitted by `skip_labels`.
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
- def changelog_pull_requests(commits, skip_labels: CHANGELOG_SKIP_LABELS)
602
- pull_requests = {}
603
- skipped = {}
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
- commits.each_slice(50) do |slice|
606
- # Ask GitHub which pull requests the commits came from, so that any merge strategy -- merge
607
- # commit, squash, or rebase -- is handled without parsing commit messages.
608
- aliases = slice.map.with_index do |commit, index|
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: "#{commit}") {
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")).each_value do |commit|
624
- next unless commit
657
+ response = changelog_graphql(aliases.join("\n"))
625
658
 
626
- commit.dig(:associatedPullRequests, :nodes).each do |pr|
627
- next unless pr[:merged]
659
+ slice.each_with_index do |oid, index|
660
+ nodes = response.dig(:"c#{index}", :associatedPullRequests, :nodes) || []
628
661
 
629
- pr = { number: pr[:number], title: pr[:title], url: pr[:url], labels: pr.dig(:labels, :nodes).map { |label| label[:name] } }
630
- if (pr[:labels] & skip_labels).empty?
631
- pull_requests[pr[:number]] ||= pr
632
- else
633
- skipped[pr[:number]] ||= pr
634
- end
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
- # There are three kinds of release: `X.Y.Z`, `X.Y.Z.pre.N`, and `X.Y.Z.dev.N`.
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
- #{body.strip}
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, a tag, and one workflow run. Everything that leaves
4
- the repository — both gems and the GitHub release — is produced by the `Release
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. Tag the release
100
+ ### 2. Run the `Release gems` workflow
101
101
 
102
- Once the pull request is merged, tag the merge commit and push the tag:
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
- ```console
105
- $ git switch master && git pull
106
- $ git tag "v$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')"
107
- $ git push origin --tags
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 tag comes before anything is published, so that the gems and the release notes describe a
111
- commit that is already immutable and because a tag can be deleted, while a version pushed to
112
- RubyGems can only be yanked.
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
- ### 3. Run the `Release gems` workflow against the tag
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
- Dispatch [`release-gems.yml`](../.github/workflows/release-gems.yml) from the Actions tab, picking
117
- the `vX.Y.Z` tag **not** a branch — in the ref selector. The trusted publisher has no branch
118
- condition, so the ref you pick is what decides what gets published; the workflow refuses to run
119
- unless the tag matches `RBS::VERSION`.
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
- - pushes both to RubyGems through trusted publishing,
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
- Dispatching against a branch runs everything up to the artifact and stops, which is how the build
135
- is exercised without releasing.
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
- ### 4. Start the next development cycle
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "4.1.1"
4
+ VERSION = "4.1.2.dev.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2.dev.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto