1- import java.util.*
21import magik.github
2+ import java.util.*
33
44plugins {
55 kotlin(" jvm" ) version " 2.2.0"
66 id(" elect86.magik" ) version " 0.3.2"
7- `maven - publish`
7+ id( " org.danilopianini. publish-on-central " ) version " 9.0.7 "
88 signing
99// id("com.github.johnrengelman.shadow") version "8.1.1"
1010}
@@ -15,7 +15,7 @@ enum class MavenRepository(val group: String) {
1515 ;
1616}
1717
18- val repository = System .getenv(" MAVEN_REPOSITORY" )?.takeIf { ! it.isBlank () }?.let { MavenRepository .valueOf(it) } ? : MavenRepository .MARY
18+ val repository = System .getenv(" MAVEN_REPOSITORY" )?.takeIf { it.isNotBlank () }?.let { MavenRepository .valueOf(it) } ? : MavenRepository .MARY
1919
2020
2121repositories {
@@ -51,13 +51,11 @@ java {
5151 withSourcesJar()
5252}
5353
54-
5554configure<PublishingExtension > {
5655 publications {
57- create <MavenPublication >( " mavenCentral " ) {
56+ withType <MavenPublication > {
5857 groupId = MavenRepository .CENTRAL .group
5958 artifactId = " glm"
60- from(components[" java" ])
6159 versionMapping {
6260 usage(" java-api" ) {
6361 fromResolutionOf(" runtimeClasspath" )
@@ -96,23 +94,17 @@ configure<PublishingExtension> {
9694 }
9795 }
9896 }
99- repositories {
100- maven {
101- name = " mavenCentral"
102- credentials {
103- username = project.properties[" NEXUS_USERNAME" ].toString()
104- password = project.properties[" NEXUS_PASSWORD" ].toString()
105- }
106-
107- url = uri(" https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" )
108- }
109- }
11097}
11198
11299signing {
113- val rawKey = project.properties[" SIGNING_KEY" ]?.toString() ? : return @signing
100+ val keyId = project.properties[" SIGNING_KEY_ID" ]?.toString()
101+ val rawKey = project.properties[" SIGNING_KEY" ]?.toString()
102+ if (keyId == null || rawKey == null ) {
103+ return @signing println (" No signing key is set!" )
104+ }
105+
114106 val key = String (Base64 .getDecoder().decode(rawKey)) // \n is not working in environment variables
115107 val password = project.properties[" SIGNING_KEY_PASSWORD" ]?.toString() ? : " "
116- useInMemoryPgpKeys(key, password)
117- sign(publishing.publications[" mavenCentral " ])
108+ useInMemoryPgpKeys(keyId, key, password)
109+ sign(publishing.publications[" OSSRH " ])
118110}
0 commit comments