Merge pull request #10117 from Rylan12/add-blog-reference-to-release-notes
Add more links to the changelog and blog
This commit is contained in:
commit
e9a44cb96c
@ -78,6 +78,7 @@ module Homebrew
|
||||
install_core_tap_if_necessary
|
||||
|
||||
updated = false
|
||||
new_repository_version = nil
|
||||
|
||||
initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].to_s
|
||||
current_revision = ENV["HOMEBREW_UPDATE_AFTER"].to_s
|
||||
@ -87,6 +88,22 @@ module Homebrew
|
||||
update_preinstall_header args: args
|
||||
puts "Updated Homebrew from #{shorten_revision(initial_revision)} to #{shorten_revision(current_revision)}."
|
||||
updated = true
|
||||
|
||||
old_tag = if (HOMEBREW_REPOSITORY/".git/config").exist?
|
||||
Utils.popen_read(
|
||||
"git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config", "--get", "homebrew.latesttag"
|
||||
).chomp.presence
|
||||
end
|
||||
|
||||
new_tag = Utils.popen_read(
|
||||
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
|
||||
).lines.first.chomp
|
||||
|
||||
if new_tag != old_tag
|
||||
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
|
||||
"--replace-all", "homebrew.latesttag", new_tag
|
||||
new_repository_version = new_tag
|
||||
end
|
||||
end
|
||||
|
||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
||||
@ -136,6 +153,21 @@ module Homebrew
|
||||
Commands.rebuild_commands_completion_list
|
||||
link_completions_manpages_and_docs
|
||||
Tap.each(&:link_completions_and_manpages)
|
||||
|
||||
return if new_repository_version.blank?
|
||||
|
||||
ohai "Homebrew was updated to version #{new_repository_version}"
|
||||
if new_repository_version.split(".").last == "0"
|
||||
puts <<~EOS
|
||||
More detailed release notes are available on the Homebrew Blog:
|
||||
#{Formatter.url("https://brew.sh/blog/#{new_repository_version}")}
|
||||
EOS
|
||||
else
|
||||
puts <<~EOS
|
||||
The changelog can be found at:
|
||||
#{Formatter.url("https://github.com/Homebrew/brew/releases/tag/#{new_repository_version}")}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def shorten_revision(revision)
|
||||
|
||||
@ -17,6 +17,10 @@ module Homebrew
|
||||
Print the merged pull requests on Homebrew/brew between two Git refs.
|
||||
If no <previous_tag> is provided it defaults to the latest tag.
|
||||
If no <end_ref> is provided it defaults to `origin/master`.
|
||||
|
||||
If `--markdown` and a <previous_tag> are passed, an extra line containing
|
||||
a link to the Homebrew blog will be adding to the output. Additionally,
|
||||
a warning will be shown if the latest minor release was less than one month ago.
|
||||
EOS
|
||||
switch "--markdown",
|
||||
description: "Print as a Markdown list."
|
||||
@ -29,6 +33,16 @@ module Homebrew
|
||||
args = release_notes_args.parse
|
||||
|
||||
previous_tag = args.named.first
|
||||
|
||||
if previous_tag.present?
|
||||
most_recent_major_minor_tag = previous_tag.sub(/\d+$/, "0")
|
||||
one_month_ago = Date.today << 1
|
||||
previous_tag_date = Date.parse Utils.popen_read(
|
||||
"git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", most_recent_major_minor_tag
|
||||
)
|
||||
opoo "The latest major/minor release was less than one month ago." if previous_tag_date > one_month_ago
|
||||
end
|
||||
|
||||
previous_tag ||= Utils.popen_read(
|
||||
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
|
||||
).lines.first.chomp
|
||||
@ -58,6 +72,9 @@ module Homebrew
|
||||
end
|
||||
|
||||
$stderr.puts "Release notes between #{previous_tag} and #{end_ref}:"
|
||||
if args.markdown? && args.named.first
|
||||
puts "Release notes for major and minor releases can be found in the [Homebrew blog](https://brew.sh/blog/)."
|
||||
end
|
||||
puts output
|
||||
end
|
||||
end
|
||||
|
||||
@ -1201,6 +1201,10 @@ Print the merged pull requests on Homebrew/brew between two Git refs.
|
||||
If no *`previous_tag`* is provided it defaults to the latest tag.
|
||||
If no *`end_ref`* is provided it defaults to `origin/master`.
|
||||
|
||||
If `--markdown` and a *`previous_tag`* are passed, an extra line containing
|
||||
a link to the Homebrew blog will be adding to the output. Additionally,
|
||||
a warning will be shown if the latest minor release was less than one month ago.
|
||||
|
||||
* `--markdown`:
|
||||
Print as a Markdown list.
|
||||
|
||||
|
||||
@ -1680,6 +1680,9 @@ Use \fBstackprof\fR instead of \fBruby\-prof\fR (the default)\.
|
||||
.SS "\fBrelease\-notes\fR [\fIoptions\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]"
|
||||
Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\.
|
||||
.
|
||||
.P
|
||||
If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containing a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-markdown\fR
|
||||
Print as a Markdown list\.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user