@@ -5,12 +5,19 @@ plugins {
55 id(" java" )
66 alias(libs.plugins.shadow)
77 alias(libs.plugins.kotlin.jvm)
8+ alias(libs.plugins.sonatype.central.portal.publisher)
9+ `maven- publish`
810}
911
10- group = " app.simplecloud.api"
11- version = " 1.0-SNAPSHOT"
12+ val baseVersion = " 0.0.1"
13+ val commitHash = System .getenv(" COMMIT_HASH" )
14+ val timestamp = System .currentTimeMillis() // Temporary to be able to build and publish directly out of fix branch with same commit hash
15+ val snapshotVersion = " ${baseVersion} -dev.${timestamp} -${commitHash} "
1216
1317allprojects {
18+ group = " app.simplecloud.plugin"
19+ version = if (commitHash != null ) snapshotVersion else baseVersion
20+
1421 repositories {
1522 mavenCentral()
1623 mavenLocal()
@@ -19,7 +26,6 @@ allprojects {
1926 maven(" https://repo.simplecloud.app/snapshots" )
2027 maven(" https://buf.build/gen/maven" )
2128 }
22-
2329}
2430
2531tasks.named(" shadowJar" , ShadowJar ::class ).configure {
@@ -30,7 +36,9 @@ subprojects {
3036 apply {
3137 plugin(rootProject.libs.plugins.shadow.get().pluginId)
3238 plugin(rootProject.libs.plugins.kotlin.jvm.get().pluginId)
39+ plugin(rootProject.libs.plugins.sonatype.central.portal.publisher.get().pluginId)
3340 }
41+
3442 java {
3543 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
3644 }
@@ -42,4 +50,35 @@ subprojects {
4250 jvmTarget.set(JvmTarget .JVM_21 )
4351 }
4452 }
53+
54+ publishing {
55+ repositories {
56+ maven {
57+ name = " simplecloud"
58+ url = uri(" https://repo.simplecloud.app/snapshots/" )
59+ credentials {
60+ username = System .getenv(" SIMPLECLOUD_USERNAME" )? : (project.findProperty(" simplecloudUsername" ) as ? String )
61+ password = System .getenv(" SIMPLECLOUD_PASSWORD" )? : (project.findProperty(" simplecloudPassword" ) as ? String )
62+ }
63+ authentication {
64+ create<BasicAuthentication >(" basic" )
65+ }
66+ }
67+ }
68+
69+ publications {
70+ create<MavenPublication >(" mavenJava" ) {
71+ from(components[" java" ])
72+ }
73+ }
74+ }
75+
76+ signing {
77+ if (commitHash != null ) {
78+ return @signing
79+ }
80+
81+ sign(publishing.publications)
82+ useGpgCmd()
83+ }
4584}
0 commit comments