Skip to content

Commit c7a716a

Browse files
committed
Add a task to build a draft of the release announcement
1 parent f27e3be commit c7a716a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

tasks/release.rb

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack activejob actionmailer actioncable railties )
2+
FRAMEWORK_NAMES = Hash.new { |h, k| k.split(/(?<=active|action)/).map(&:capitalize).join(" ") }
23

34
root = File.expand_path('../../', __FILE__)
45
version = File.read("#{root}/RAILS_VERSION").strip
56
tag = "v#{version}"
7+
gem_version = Gem::Version.new(version)
68

79
directory "pkg"
810

@@ -176,3 +178,70 @@
176178

177179
task :release => %w(prep_release tag push)
178180
end
181+
182+
task :announce do
183+
Dir.chdir("pkg/") do
184+
if gem_version.segments[2] == 0 || gem_version.segments[3].is_a?(Integer)
185+
# Not major releases, and not security releases
186+
raise "Only valid for patch releases"
187+
end
188+
189+
sums = "$ shasum *-#{version}.gem\n" + `shasum *-#{version}.gem`
190+
191+
puts "Hi everyone,"
192+
puts
193+
194+
puts "I am happy to announce that Rails #{version} has been released."
195+
puts
196+
197+
previous_version = gem_version.segments[0, 3]
198+
previous_version[2] -= 1
199+
previous_version = previous_version.join(".")
200+
201+
if version =~ /rc/
202+
require "date"
203+
future_date = Date.today + 5
204+
future_date += 1 while future_date.saturday? || future_date.sunday?
205+
206+
github_user = `git config github.user`.chomp
207+
208+
puts <<MSG
209+
If no regressions are found, expect the final release on #{future_date.strftime('%A, %B %-d, %Y')}.
210+
If you find one, please open an [issue on GitHub](https://github.com/rails/rails/issues/new)
211+
#{"and mention me (@#{github_user}) on it, " unless github_user.empty?}so that we can fix it before the final release.
212+
213+
MSG
214+
end
215+
216+
puts <<MSG
217+
## CHANGES since #{previous_version}
218+
219+
To view the changes for each gem, please read the changelogs on GitHub:
220+
221+
MSG
222+
FRAMEWORKS.sort.each do |framework|
223+
puts "* [#{FRAMEWORK_NAMES[framework]} CHANGELOG](https://github.com/rails/rails/blob/v#{version}/#{framework}/CHANGELOG.md)"
224+
end
225+
puts <<MSG
226+
227+
*Full listing*
228+
229+
To see the full list of changes, [check out all the commits on
230+
GitHub](https://github.com/rails/rails/compare/v#{previous_version}...v#{version}).
231+
232+
## SHA-1
233+
234+
If you'd like to verify that your gem is the same as the one I've uploaded,
235+
please use these SHA-1 hashes.
236+
237+
Here are the checksums for #{version}:
238+
239+
```
240+
#{sums}
241+
```
242+
243+
As always, huge thanks to the many contributors who helped with this release.
244+
245+
MSG
246+
end
247+
end

0 commit comments

Comments
 (0)