From: Jim Procter Date: Tue, 10 Sep 2024 15:24:26 +0000 (+0100) Subject: JAL-4454 allow channels to pick up most recent 'whatsNew' and releasenotes for their... X-Git-Tag: Release_2_11_4_0~13^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=08ed00519c5f652f91e8403ae1ea2790a479394f;p=jalview.git JAL-4454 allow channels to pick up most recent 'whatsNew' and releasenotes for their associated version --- diff --git a/build.gradle b/build.gradle index b9b3ad9..a199713 100644 --- a/build.gradle +++ b/build.gradle @@ -1322,6 +1322,25 @@ def mdFileComponents(File mdFile, def dateOnly=false) { return dateOnly ? map["date"] : [map, content] } +def setReleaseAndWhatsNew(File whatsnewMdFile, File releaseMdFile) { + if (CHANNEL != "") { + // we may have a version string that has additional bits vs the actual release version + if (CHANNEL != "RELEASE") + { + var nearestVersion = "${JALVIEW_VERSION_UNDERSCORES}" + print "Stripping rc/test/etc for ${nearestVersion}" + nearestVersion = nearestVersion.replaceAll(~/\-?(d|rc|test|develop|dev).+/,"") + var nearestMd = file("${jalviewDir}/${whatsnew_dir}/whatsnew-${nearestVersion}.md") + print "Looking in ${nearestMd}" + if (nearestMd.exists()) { + whatsnewMdFile = nearestMd + releaseMdFile = file("${jalviewDir}/${releases_dir}/release-${nearestVersion}.md") + } + } + } + return [whatsnewMdFile,releaseMdFile] +} + task hugoTemplates { group "website" description "Create partially populated md pages for hugo website build" @@ -1341,16 +1360,18 @@ task hugoTemplates { def givenDate = null def givenChannel = null def givenVersion = null - if (CHANNEL == "RELEASE") { + + if (CHANNEL!="") { + (whatsnewMdFile, releaseMdFile) = setReleaseAndWhatsNew(whatsnewMdFile, releaseMdFile) + def (map, content) = mdFileComponents(releaseMdFile) givenDate = map.date givenChannel = map.channel givenVersion = map.version changes = content - if (givenVersion != null && givenVersion != JALVIEW_VERSION) { + if (CHANNEL=="RELEASE" && givenVersion != null && givenVersion != JALVIEW_VERSION) { throw new GradleException("'version' header (${givenVersion}) found in ${releaseMdFile} does not match JALVIEW_VERSION (${JALVIEW_VERSION})") } - if (whatsnewMdFile.exists()) whatsnew = whatsnewMdFile.text } @@ -1517,6 +1538,8 @@ task releasesTemplates { def releaseMdFile = file("${releasesMdDir}/release-${JALVIEW_VERSION_UNDERSCORES}.md") def whatsnewMdFile = file("${whatsnewMdDir}/whatsnew-${JALVIEW_VERSION_UNDERSCORES}.md") + (whatsnewMdFile,releaseMdFile) = setReleaseAndWhatsNew(whatsnewMdFile, releaseMdFile) + if (CHANNEL == "RELEASE") { if (!releaseMdFile.exists()) { throw new GradleException("File ${releaseMdFile} must be created for RELEASE")