Skip to content

Commit a53b29a

Browse files
committed
wip adding release highlights
1 parent 8b1c3b8 commit a53b29a

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGenerator.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
import java.util.HashMap;
1919
import java.util.List;
2020
import java.util.Map;
21+
import java.util.Objects;
2122
import java.util.Set;
2223
import java.util.TreeMap;
2324

2425
import static java.util.Comparator.comparing;
26+
import static java.util.Comparator.comparingInt;
2527
import static java.util.stream.Collectors.groupingBy;
2628
import static java.util.stream.Collectors.toList;
2729

@@ -66,12 +68,23 @@ static void update(File templateFile, File outputFile, QualifiedVersion version,
6668
static String generateFile(String template, QualifiedVersion version, Set<ChangelogEntry> changelogs) throws IOException {
6769
final var changelogsByTypeByArea = buildChangelogBreakdown(changelogs);
6870

71+
final Map<Boolean, List<ChangelogEntry.Highlight>> groupedHighlights = changelogs.stream()
72+
.map(ChangelogEntry::getHighlight)
73+
.filter(Objects::nonNull)
74+
.sorted(comparingInt(ChangelogEntry.Highlight::getPr))
75+
.collect(groupingBy(ChangelogEntry.Highlight::isNotable, toList()));
76+
77+
final List<ChangelogEntry.Highlight> notableHighlights = groupedHighlights.getOrDefault(true, List.of());
78+
final List<ChangelogEntry.Highlight> nonNotableHighlights = groupedHighlights.getOrDefault(false, List.of());
79+
6980
final Map<String, Object> bindings = new HashMap<>();
7081
bindings.put("version", version);
7182
bindings.put("changelogsByTypeByArea", changelogsByTypeByArea);
7283
bindings.put("TYPE_LABELS", TYPE_LABELS);
7384
bindings.put("unqualifiedVersion", version.withoutQualifier());
7485
bindings.put("versionWithoutSeparator", version.withoutQualifier().toString().replaceAll("\\.", ""));
86+
bindings.put("notableHighlights", notableHighlights);
87+
bindings.put("nonNotableHighlights", nonNotableHighlights);
7588

7689
return TemplateUtils.render(template, bindings);
7790
}

build-tools-internal/src/main/resources/templates/index.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,24 @@ To check for security updates, go to [Security announcements for the Elastic sta
2626

2727
## ${unqualifiedVersion} [elasticsearch-${versionWithoutSeparator}-release-notes]
2828
**Release date:** April 01, 2025
29+
2930
<%
31+
if (!notableHighlights.isEmpty() || !nonNotableHighlights.isEmpty()) {
32+
print "### Highlights\n"
33+
}
34+
35+
for (highlights in [notableHighlights, nonNotableHighlights]) {
36+
if (!highlights.isEmpty()) {
37+
for (highlight in highlights) { %>
38+
::::{dropdown} ${highlight.title}
39+
${highlight.body.trim()}
40+
41+
For more information, check [PR #${highlight.pr}](https://github.com/elastic/elasticsearch/pull/${highlight.pr}).
42+
::::
43+
<% }
44+
}
45+
}
46+
3047
for (changeType in ['features-enhancements', 'fixes', 'regression']) {
3148
if (changelogsByTypeByArea[changeType] == null || changelogsByTypeByArea[changeType].empty) {
3249
continue;
@@ -40,7 +57,7 @@ for (changeType in ['features-enhancements', 'fixes', 'regression']) {
4057
print "* ${change.summary} [#${change.pr}](https://github.com/elastic/elasticsearch/pull/${change.pr})"
4158
if (change.issues != null && change.issues.empty == false) {
4259
print change.issues.size() == 1 ? " (issue: " : " (issues: "
43-
print change.issues.collect { "{es-issue}${it}[#${it}]" }.join(", ")
60+
print change.issues.collect { "[#${change.pr}](https://github.com/elastic/elasticsearch/pull/${change.pr})" }.join(", ")
4461
print ")"
4562
}
4663
print "\n"

0 commit comments

Comments
 (0)