Skip to content

Commit cc8e790

Browse files
committed
Infer POM tag from version
1 parent 3e12892 commit cc8e790

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

buildSrc/src/main/kotlin/BotCommands-publish-conventions.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ version = Version(
3737
classifier = providers.gradleProperty("version.classifier").get(),
3838
)
3939

40-
val effectiveTag = if (canPublish) {
41-
GitUtils.getHeadTag(logger, providers, projectDir.absolutePath) ?: error("Attempted to publish on a non-release commit")
42-
} else {
43-
"3.X"
44-
}
40+
val effectiveTag = if (canPublish) "v${version}" else "3.X"
4541

4642
java {
4743
withSourcesJar()

buildSrc/src/main/kotlin/GitUtils.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,4 @@ object GitUtils {
5050
return null
5151
}
5252
}
53-
54-
fun getHeadTag(logger: Logger, providers: ProviderFactory, directory: String): String? {
55-
try {
56-
val output = providers.exec {
57-
commandLine("git", "describe", "--tags", "--abbrev=0", "--exact-match")
58-
workingDir(directory)
59-
isIgnoreExitValue = true
60-
}
61-
62-
if (output.result.get().exitValue == 128) { return null }
63-
64-
return output.standardOutput.asText.get().lineSequence().first()
65-
} catch (e: Exception) {
66-
logger.error("Unable to get head tag", e)
67-
return null
68-
}
69-
}
7053
}

0 commit comments

Comments
 (0)