Skip to content

Commit

Permalink
ci: add git ref to version when publishing
Browse files Browse the repository at this point in the history
Signed-off-by: Mariell Hoversholm <[email protected]>
  • Loading branch information
Proximyst authored and Mariell Hoversholm committed Dec 3, 2021
1 parent 75cbfc7 commit 2e86f71
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions build-logic/src/main/kotlin/moonshine.publishing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ indra {
}
}

publishing {
repositories {
if (System.getenv("GITHUB_PACKAGES") != null) {
if (System.getenv("GITHUB_PACKAGES") != null) {
afterEvaluate {
if (version.toString().endsWith("-SNAPSHOT")) {
val ref = System.getenv("GITHUB_REF")?.split('/', limit = 3)?.last()
?: System.getenv("GITHUB_SHA")!!.take(6)
version = "$version+git.$ref"
}
}

publishing {
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/KyoriPowered/moonshine")
Expand Down

0 comments on commit 2e86f71

Please sign in to comment.