diff options
author | Matthew Draper <matthew@trebex.net> | 2016-12-01 03:58:22 +1030 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-02-23 15:06:34 -0500 |
commit | d7c8d34cc45568468c5f1ad2c054f6e78ae9860f (patch) | |
tree | b12645daf07b7312d5b39e6ff976eaf863ac6ffd /tasks | |
parent | d9d28d2437545c5d30a29d1f2cd44ced88fb90a6 (diff) | |
download | rails-d7c8d34cc45568468c5f1ad2c054f6e78ae9860f.tar.gz rails-d7c8d34cc45568468c5f1ad2c054f6e78ae9860f.tar.bz2 rails-d7c8d34cc45568468c5f1ad2c054f6e78ae9860f.zip |
Add a task to build a draft of the release announcement
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/release.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tasks/release.rb b/tasks/release.rb index 1e2873b7f3..25269fb7db 100644 --- a/tasks/release.rb +++ b/tasks/release.rb @@ -1,8 +1,10 @@ FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack activejob actionmailer actioncable railties ) +FRAMEWORK_NAMES = Hash.new { |h, k| k.split(/(?<=active|action)/).map(&:capitalize).join(" ") } root = File.expand_path("../../", __FILE__) version = File.read("#{root}/RAILS_VERSION").strip tag = "v#{version}" +gem_version = Gem::Version.new(version) directory "pkg" @@ -177,3 +179,70 @@ namespace :all do task release: %w(ensure_clean_state build bundle commit tag push) end + +task :announce do + Dir.chdir("pkg/") do + if gem_version.segments[2] == 0 || gem_version.segments[3].is_a?(Integer) + # Not major releases, and not security releases + raise "Only valid for patch releases" + end + + sums = "$ shasum *-#{version}.gem\n" + `shasum *-#{version}.gem` + + puts "Hi everyone," + puts + + puts "I am happy to announce that Rails #{version} has been released." + puts + + previous_version = gem_version.segments[0, 3] + previous_version[2] -= 1 + previous_version = previous_version.join(".") + + if version =~ /rc/ + require "date" + future_date = Date.today + 5 + future_date += 1 while future_date.saturday? || future_date.sunday? + + github_user = `git config github.user`.chomp + + puts <<MSG +If no regressions are found, expect the final release on #{future_date.strftime('%A, %B %-d, %Y')}. +If you find one, please open an [issue on GitHub](https://github.com/rails/rails/issues/new) +#{"and mention me (@#{github_user}) on it, " unless github_user.empty?}so that we can fix it before the final release. + +MSG + end + + puts <<MSG +## CHANGES since #{previous_version} + +To view the changes for each gem, please read the changelogs on GitHub: + +MSG + FRAMEWORKS.sort.each do |framework| + puts "* [#{FRAMEWORK_NAMES[framework]} CHANGELOG](https://github.com/rails/rails/blob/v#{version}/#{framework}/CHANGELOG.md)" + end + puts <<MSG + +*Full listing* + +To see the full list of changes, [check out all the commits on +GitHub](https://github.com/rails/rails/compare/v#{previous_version}...v#{version}). + +## SHA-1 + +If you'd like to verify that your gem is the same as the one I've uploaded, +please use these SHA-1 hashes. + +Here are the checksums for #{version}: + +``` +#{sums} +``` + +As always, huge thanks to the many contributors who helped with this release. + +MSG + end +end |