Skip to content

Commit 32c0569

Browse files
committed
Automatically update the latest version in the README
1 parent f302e4f commit 32c0569

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
1515
| Interpreter | Versions |
1616
| ----------- | -------- |
1717
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.1.0, head, debug, mingw, mswin |
18-
| `jruby` | 9.1.17.0 - 9.3.2.0, head |
18+
| `jruby` | 9.1.17.0 - 9.3.3.0, head |
1919
| `truffleruby` | 19.3.0 - 21.3.0, head |
2020
| `truffleruby+graalvm` | 21.2.0 - 21.3.0, head |
2121

new-version.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
raise unless version[MATCH]
1111

12+
# Update ruby-builder-versions.json
1213
file = "#{__dir__}/ruby-builder-versions.json"
1314
lines = File.readlines(file, chomp: true)
1415

@@ -26,9 +27,23 @@
2627
}
2728

2829
if release_line
29-
release_line << " #{version.inspect},"
30+
append = " #{version.inspect},"
31+
release_line << append unless release_line.end_with?(append)
3032
else
3133
lines.insert to+1, " #{version.inspect},"
3234
end
3335

3436
File.write(file, lines.join("\n") + "\n")
37+
38+
# Update README.md
39+
file = "#{__dir__}/README.md"
40+
lines = File.readlines(file)
41+
engine_line = lines.find { |line| line.start_with?("| `#{engine}`") }
42+
engine_line.sub!(/(.+ (?:-|until)) (\d+(?:\.\d+)+)/) do
43+
if Gem::Version.new(version) > Gem::Version.new($2)
44+
"#{$1} #{version}"
45+
else
46+
$&
47+
end
48+
end
49+
File.write(file, lines.join)

0 commit comments

Comments
 (0)