Skip to content

Commit

Permalink
Add updateVersion gradle task from plugin template (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrross authored Nov 18, 2023
1 parent 9ef641d commit 82a4fea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,13 @@ tasks.withType(PublishToMavenRepository) {
predicate.get()
}
}

task updateVersion {
onlyIf { System.getProperty('newVersion') }
doLast {
ext.newVersion = System.getProperty('newVersion')
println "Setting version to ${newVersion}."
// String tokenization to support -SNAPSHOT
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
}
}

0 comments on commit 82a4fea

Please sign in to comment.