Skip to content

Commit

Permalink
add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjenx committed Jul 25, 2024
1 parent 85d0155 commit 205acb3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,20 @@ publishing {
}
}

@Suppress("UnstableApiUsage")
val gitCurrentTag = providers.exec { commandLine("git", "describe", "--abbrev=0", "--tags") }
.standardOutput.asText.map { it.trim() }

// get git shortSha for version
@Suppress("UnstableApiUsage")
val gitSha = providers.exec { commandLine("git", "rev-parse", "--short", "HEAD") }
.standardOutput.asText.map { it.trim() }

mavenPublishing {
coordinates("com.chrisjenx.yakcov", "library", "1.0.0-${gitSha.get()}")
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
// If gradle property release true remove sha from version
version = if (project.hasProperty("release")) gitCurrentTag.get()
else "${gitCurrentTag.get()}-${gitSha.get()}"
coordinates("com.chrisjenx.yakcov", "library", version = version.toString())
signAllPublications()

pom {
Expand Down

0 comments on commit 205acb3

Please sign in to comment.