mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2025-01-09 09:37:33 +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:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [ published ]
|
types: [ published ]
|
||||||
|
workflow_dispatch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -7,11 +7,6 @@ plugins {
|
|||||||
id("com.diffplug.spotless") version "6.1.2"
|
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()))
|
fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
|
||||||
.directory(projectDir)
|
.directory(projectDir)
|
||||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||||
@ -28,8 +23,18 @@ fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`]
|
|||||||
|
|
||||||
val gitHash = "git rev-parse --verify HEAD".runCommand()
|
val gitHash = "git rev-parse --verify HEAD".runCommand()
|
||||||
val clean = "git status --porcelain".runCommand().isEmpty()
|
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)")
|
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
|
val javaTarget = 11
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.toVersion(javaTarget)
|
sourceCompatibility = JavaVersion.toVersion(javaTarget)
|
||||||
@ -105,7 +110,7 @@ publishing {
|
|||||||
publications {
|
publications {
|
||||||
register<MavenPublication>("gpr") {
|
register<MavenPublication>("gpr") {
|
||||||
from(components["java"])
|
from(components["java"])
|
||||||
artifactId = "BlueMapAPI"
|
artifactId = "bluemap_api"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
apiVersion=2.0.0
|
|
||||||
|
Loading…
Reference in New Issue
Block a user