summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-02-10 08:42:42 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-02-10 09:26:12 +0900
commit07bf97e94f44b51df104c37fb2e93bd0d882db32 (patch)
tree35f6794a9689a2b985ba88f516ce0188e53a6d96 /tool
parent2c8e4aa2a0ff7aa92b81b4ed6ea890bc03332c0c (diff)
Enhancement github releases generator
* Create GitHub Releases by itself * Added help and usage message * Decorate release body
Diffstat (limited to 'tool')
-rwxr-xr-xtool/gen-github-release.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/tool/gen-github-release.rb b/tool/gen-github-release.rb
index f58828b8b4..4d8c2910f4 100755
--- a/tool/gen-github-release.rb
+++ b/tool/gen-github-release.rb
@@ -1,5 +1,11 @@
#!/usr/bin/env ruby
+if ARGV.size < 2
+ puts "Usage: #{$0} <from version tag> <to version tag> [--no-dry-run]"
+ puts " : if --no-dry-run is specified, it will create a release on GitHub"
+ exit 1
+end
+
require "bundler/inline"
gemfile do
@@ -19,6 +25,8 @@ end
client = Octokit::Client.new
+note = "## What's Changed\n\n"
+
diff = client.compare("ruby/ruby", ARGV[0], ARGV[1])
diff[:commits].each do |c|
if c[:commit][:message] =~ /\[Backport #(\d*)\]/
@@ -32,8 +40,20 @@ diff[:commits].each do |c|
else
next
end
- puts "* [#{title}](#{url})"
+ note << "* [#{title}](#{url})\n"
rescue OpenURI::HTTPError
puts "Error: #{url}"
end
+note << "\n"
+note << "Note: This list is automatically generated by tool/gen-github-release.rb. Because of this, some commits may be missing.\n\n"
+note << "## Full Changelog\n\n"
+note << "https://github.com/ruby/ruby/compare/#{ARGV[0]}...#{ARGV[1]}\n\n"
+
+if ARGV[2] == "--no-dry-run"
+ name = ARGV[1].gsub(/v/, "").gsub(/_/, ".")
+ client.create_release("ruby/ruby", ARGV[1], name: name, body: note)
+ puts "Created a release: https://github.com/ruby/ruby/releases/tag/#{ARGV[1]}"
+else
+ puts note
+end