Skip to content

Commit 184a5f2

Browse files
prudhvigodithigithub-actions[bot]
authored andcommitted
Staging for version increment automation (#391)
* Version increment automation Signed-off-by: pgodithi <[email protected]> * Version increment automation Signed-off-by: pgodithi <[email protected]> * Version increment automation Signed-off-by: pgodithi <[email protected]> * Version increment automation Signed-off-by: pgodithi <[email protected]> * Version increment automation Signed-off-by: pgodithi <[email protected]> * Version increment automation: task rename updateVersion Signed-off-by: pgodithi <[email protected]> (cherry picked from commit 6667bfb)
1 parent 072ac50 commit 184a5f2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reports-scheduler/build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,21 @@ if (!usingRemoteCluster && !usingMultiNode) {
488488
}
489489

490490
apply from: 'build-tools/pkgbuild.gradle'
491+
492+
// updateVersion: Task to auto increment to the next development iteration
493+
task updateVersion {
494+
onlyIf { System.getProperty('newVersion') }
495+
doLast {
496+
ext.newVersion = System.getProperty('newVersion')
497+
println "Setting version to ${newVersion}."
498+
// String tokenization to support -SNAPSHOT
499+
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
500+
ant.replaceregexp(file:'../.github/workflows/dashboards-reports-test-and-build-workflow.yml', match:'OPENSEARCH_PLUGIN_VERSION: \\d+.\\d+.\\d+.\\d+', replace:'OPENSEARCH_PLUGIN_VERSION: ' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true)
501+
ant.replaceregexp(file:'../.github/workflows/draft-release-notes-workflow.yml', match:'version: \\d+.\\d+.\\d+.\\d+', replace:'version: ' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true)
502+
// Match key version in JSON files.
503+
ant.replaceregexp(file:'../dashboards-reports/opensearch_dashboards.json', match:'"version": "\\d+.\\d+.\\d+.\\d+', replace:'"version": ' + '"' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true)
504+
ant.replaceregexp(file:'../dashboards-reports/package.json', match:'"version": "\\d+.\\d+.\\d+.\\d+', replace:'"version": ' + '"' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true)
505+
// Match key opensearchDashboardsVersion in JSON files.
506+
ant.replaceregexp(file:'../dashboards-reports/opensearch_dashboards.json', match:'"opensearchDashboardsVersion": "\\d+.\\d+.\\d+', replace:'"opensearchDashboardsVersion": ' + '"' + newVersion.tokenize('-')[0], flags:'g', byline:true)
507+
}
508+
}

0 commit comments

Comments
 (0)