File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name: Java CI
33on :
44 release :
55 types : [ published ]
6+ workflow_dispatch
67
78jobs :
89 build :
Original file line number Diff line number Diff line change @@ -7,11 +7,6 @@ plugins {
77 id(" com.diffplug.spotless" ) version " 6.1.2"
88}
99
10- group = " de.bluecolored.bluemap.api"
11-
12- val apiVersion: String by project
13- version = apiVersion
14-
1510fun String.runCommand (): String = ProcessBuilder (split(" \\ s(?=(?:[^'\" `]*(['\" `])[^'\" `]*\\ 1)*[^'\" `]*$)" .toRegex()))
1611 .directory(projectDir)
1712 .redirectOutput(ProcessBuilder .Redirect .PIPE )
@@ -28,8 +23,18 @@ fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`]
2823
2924val gitHash = " git rev-parse --verify HEAD" .runCommand()
3025val clean = " git status --porcelain" .runCommand().isEmpty()
26+ val lastTag = " git describe --tags --abbrev=0" .runCommand()
27+ val lastVersion = lastTag.substring(1 ) // remove the leading 'v'
28+ val commits = " git rev-list --count $lastTag ..HEAD" .runCommand()
3129println (" Git hash: $gitHash " + if (clean) " " else " (dirty)" )
3230
31+ group = " de.bluecolored.bluemap.api"
32+ version = lastVersion +
33+ (if (commits == " 0" ) " " else " -$commits " ) +
34+ (if (clean) " " else " -dirty" )
35+
36+ println (" Version: $version " )
37+
3338val javaTarget = 11
3439java {
3540 sourceCompatibility = JavaVersion .toVersion(javaTarget)
@@ -105,7 +110,7 @@ publishing {
105110 publications {
106111 register<MavenPublication >(" gpr" ) {
107112 from(components[" java" ])
108- artifactId = " BlueMapAPI "
113+ artifactId = " bluemap_api "
109114 }
110115 }
111116}
Original file line number Diff line number Diff line change 11org.gradle.jvmargs =-Xmx3G
22org.gradle.daemon =false
3-
4- apiVersion =2.0.0
You can’t perform that action at this time.
0 commit comments