mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2025-01-08 09:07:34 +01:00
Try to fix publication and versioning
This commit is contained in:
parent
3ccc1aad81
commit
25f113ebdb
1
.github/workflows/publish.yml
vendored
1
.github/workflows/publish.yml
vendored
@ -3,6 +3,7 @@ name: Java CI
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -7,11 +7,6 @@ plugins {
|
||||
id("com.diffplug.spotless") version "6.1.2"
|
||||
}
|
||||
|
||||
group = "de.bluecolored.bluemap.api"
|
||||
|
||||
val apiVersion: String by project
|
||||
version = apiVersion
|
||||
|
||||
fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
|
||||
.directory(projectDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
@ -28,8 +23,18 @@ fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`]
|
||||
|
||||
val gitHash = "git rev-parse --verify HEAD".runCommand()
|
||||
val clean = "git status --porcelain".runCommand().isEmpty()
|
||||
val lastTag = "git describe --tags --abbrev=0".runCommand()
|
||||
val lastVersion = lastTag.substring(1) // remove the leading 'v'
|
||||
val commits = "git rev-list --count $lastTag..HEAD".runCommand()
|
||||
println("Git hash: $gitHash" + if (clean) "" else " (dirty)")
|
||||
|
||||
group = "de.bluecolored.bluemap.api"
|
||||
version = lastVersion +
|
||||
(if (commits == "0") "" else "-$commits") +
|
||||
(if (clean) "" else "-dirty")
|
||||
|
||||
println("Version: $version")
|
||||
|
||||
val javaTarget = 11
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.toVersion(javaTarget)
|
||||
@ -105,7 +110,7 @@ publishing {
|
||||
publications {
|
||||
register<MavenPublication>("gpr") {
|
||||
from(components["java"])
|
||||
artifactId = "BlueMapAPI"
|
||||
artifactId = "bluemap_api"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,2 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
apiVersion=2.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user