Skip to content

Commit 3f4095c

Browse files
authored
Add "new add-ons" section to milestone release notes (openhab#1835)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
1 parent bc9bfb7 commit 3f4095c

1 file changed

Lines changed: 46 additions & 1 deletion

File tree

launch/build.gradle

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,35 @@ task buildChangelog {
203203
case "enhancement":
204204
pullType="enhancement"
205205
break
206+
case ~/^new(.+)/:
207+
if (repoName == "openhab-core") {
208+
pullType="feature"
209+
pullAddon="Core"
210+
} else {
211+
def addonTypeURL
212+
pullType = "new"
213+
addonType = Matcher.lastMatcher[0][1].trim().capitalize()
214+
if (addonType == "Contribution") { addonType = "Binding" }
215+
if (addonType == "Transform") { addonType = "Transformation" }
216+
if ((addonType != "Voice") && (addonType != "Persistence")) {
217+
addonTypeURL = (addonType + "s").toLowerCase()
218+
} else {
219+
addonTypeURL = addonType.toLowerCase()
220+
}
221+
docsURL = "https://next.openhab.org/addons/${addonTypeURL}/${pullAddon}/"
222+
223+
def url = docsURL.toURL()
224+
Pattern htmlPattern = Pattern.compile(".*<title>(.*) - .* \\| openHAB<\\/title>")
225+
try {
226+
Matcher htmlMatcher = htmlPattern.matcher(url.text)
227+
if (htmlMatcher.find()) {
228+
pullAddon = htmlMatcher.group(1)
229+
}
230+
} catch (FileNotFoundException e) {
231+
println " Warning: New contribution PR #${pullNumber} does not have a [name]..."
232+
}
233+
}
234+
break
206235
}
207236
}
208237

@@ -252,7 +281,23 @@ task buildChangelog {
252281
// Extract the major.minor version (a.b) from milestone version (a.b.c.Mx)
253282
def baseVersion = openHABVersion.replaceAll(/\.M\d+$/, '') // Remove .Mx suffix
254283
def majorMinorVersion = baseVersion.replaceAll(/\.\d+$/, '') // Remove patch version to get major.minor
255-
outputText = outputText + "\nThis is a monthly milestone build for the upcoming openHAB ${majorMinorVersion} release, which brings many fixes and improvements.\n"
284+
outputText = outputText + "\nThis is a monthly milestone build for the upcoming openHAB ${majorMinorVersion} release, which brings many fixes and improvements.\n\n"
285+
286+
// check for new add-ons
287+
def sortedList = fullChangeList.findAll{it.type == "new"}.sort{it.addon.toLowerCase()}
288+
289+
if (sortedList.size() > 0) {
290+
outputText = outputText + "### New Add-ons\n\n"
291+
outputText = outputText + "The following add-ons are newly introduced:\n\n"
292+
outputText = outputText + "| Add-on | Type | Issue |\n"
293+
outputText = outputText + "|-|-|-|\n"
294+
295+
sortedList.each {
296+
outputText = outputText + "| [**${it.addon}**](${it.docs}) | ${it.class} | [#${it.number}](${it.url}) |\n"
297+
}
298+
299+
outputText = outputText + "\nThe following improvements were made:\n"
300+
}
256301
} else {
257302
outputText = outputText + "\nThis patch release contains the following bug fixes:\n"
258303
}

0 commit comments

Comments
 (0)