Skip to content

Commit

Permalink
add updateSnapshotVersion task for pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
farrell-m committed May 15, 2024
1 parent 0e072ec commit dcf1cf7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@ subprojects {
it.jvmArgs = ["--add-opens=java.base/java.lang=ALL-UNNAMED"]
}
}

task updateSnapshotVersion {
doLast {
def gitHash = "git rev-parse --short HEAD".execute().text.trim()
def propertiesFile = file('gradle.properties')
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))

def currentVersion = properties.getProperty('version')
def newVersion = currentVersion.replace('-SNAPSHOT', "-${gitHash}-SNAPSHOT")
properties.setProperty('version', newVersion)

properties.store(propertiesFile.newWriter(), null)
}
}

0 comments on commit dcf1cf7

Please sign in to comment.