Skip to content

Commit

Permalink
chore: update version file in release script.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Jul 17, 2024
1 parent ec338be commit ce258d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ fun runCommand(vararg args: String): String {
}

fun setCurrentVersion(version: String) {
val gradleProperties = File("build.gradle.kts")
val gradleProperties = File("librarian.properties")
val newContent = gradleProperties.readLines().map {
it.replace(Regex("version = .*"), "version = \"$version\"")
it.replace(Regex("pom.version=.*"), "pom.version=\"$version\"")
}.joinToString(separator = "\n", postfix = "\n")
gradleProperties.writeText(newContent)
}

fun getCurrentVersion(): String {
val versionLines = File("build.gradle.kts").readLines().filter { it.startsWith("version =") }
val versionLines = File("librarian.properties").readLines().filter { it.startsWith("pom.version=") }

require(versionLines.isNotEmpty()) {
"cannot find the version in ./gradle.properties"
Expand All @@ -41,7 +41,7 @@ fun getCurrentVersion(): String {
"multiple versions found in ./gradle.properties"
}

val regex = Regex("version = \"(.*)-SNAPSHOT\"")
val regex = Regex("pom.version=(.*)-SNAPSHOT")
val matchResult = regex.matchEntire(versionLines.first())

require(matchResult != null) {
Expand Down

0 comments on commit ce258d7

Please sign in to comment.