From 5ac12922d584cb2773fbf7a366c488c4207f6cd1 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:51:31 -0700 Subject: [PATCH] [Backport 1.x] Staging for version increment automation (#500) * Staging for version increment automation (#489) * Version increment automation Signed-off-by: pgodithi * Version increment automation: task rename updateVersion Signed-off-by: pgodithi (cherry picked from commit 3b8bfe7c7b2cdc42a4da338af63edf9e1150cbd4) Signed-off-by: prudhvigodithi * DCO fix Signed-off-by: prudhvigodithi Signed-off-by: pgodithi Signed-off-by: prudhvigodithi Co-authored-by: Prudhvi Godithi --- build.gradle | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.gradle b/build.gradle index c0449da69..3d4455133 100644 --- a/build.gradle +++ b/build.gradle @@ -88,3 +88,20 @@ allprojects { evaluationDependsOnChildren() check.dependsOn subprojects*.check + +// updateVersion: Task to auto increment to the next development iteration +task updateVersion { + onlyIf { System.getProperty('newVersion') } + doLast { + ext.newVersion = System.getProperty('newVersion') + println "Setting version to ${newVersion}." + // String tokenization to support -SNAPSHOT + ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { + fileset(dir: projectDir) { + // Include the required files that needs to be updated with new Version + include(name: "alerting/build.gradle") + } + } + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) + } +} \ No newline at end of file