Skip to content

Commit

Permalink
Staging Version increment automation (opensearch-project#239)
Browse files Browse the repository at this point in the history
* Version increment automation

Signed-off-by: pgodithi <pgodithi@amazon.com>

* Version increment automation: task rename updateVersion

Signed-off-by: pgodithi <pgodithi@amazon.com>
  • Loading branch information
prudhvigodithi committed Aug 1, 2022
1 parent 8dc457e commit a587fa8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
buildscript {

ext {
opensearch_version = System.getProperty("opensearch.version", "1.0.0")
opensearch_version = System.getProperty("opensearch.version", "1.0.0-SNAPSHOT")
}
// This isn't applying from repositories.gradle so repeating it here
repositories {
Expand Down Expand Up @@ -531,3 +531,21 @@ afterEvaluate {

bundlePlugin.mustRunAfter unpackRca
build.dependsOn unpackRca

// 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: ".github/workflows/gradle.yml")
include(name: "src/main/resources/plugin-descriptor.properties")
}
}
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
}
}

0 comments on commit a587fa8

Please sign in to comment.