diff --git a/build.gradle b/build.gradle index 2a9b663..b562929 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } plugins { - id 'com.diffplug.spotless' version '5.1.1' apply false + id 'com.diffplug.spotless' version '6.5.0' apply false id 'org.asciidoctor.jvm.convert' version '3.3.0' id 'org.ajoberstar.git-publish' version '3.0.1' id 'org.ajoberstar.grgit' version '4.1.1' @@ -147,3 +147,18 @@ task checkLastVersionValue { } } } + +def updateLastVersionValueTask = tasks.register('updateLastVersionValue') { + doLast { + def propertiesFile = file('gradle.properties') + def content = propertiesFile.text + content = content.replaceAll("lastVersion=[0-9\\.]+", "lastVersion=" + version.replace('-SNAPSHOT', '')) + propertiesFile.text = content + } +} + +model { + tasks.unSnapshotVersion { + dependsOn updateLastVersionValueTask + } +}