Skip to content

Commit

Permalink
fix: gradle artifact signing (#203)
Browse files Browse the repository at this point in the history
Signed-off-by: Allain Magyar <[email protected]>
  • Loading branch information
amagyar-iohk authored Sep 13, 2024
1 parent 59c9537 commit c5903ff
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 111 deletions.
113 changes: 2 additions & 111 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.gradle.internal.os.OperatingSystem

val publishedMavenId = "org.hyperledger.identus"
val groupId = "org.hyperledger.identus"
val os: OperatingSystem = OperatingSystem.current()

plugins {
Expand All @@ -10,8 +10,6 @@ plugins {
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
id("org.jetbrains.dokka") version "1.9.20"
id("org.jetbrains.kotlin.kapt") version "1.9.10"
id("maven-publish")
id("signing")
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

Expand All @@ -37,7 +35,7 @@ java {
}

allprojects {
this.group = publishedMavenId
this.group = groupId

repositories {
mavenLocal()
Expand Down Expand Up @@ -101,113 +99,6 @@ subprojects {
}
}
}

if (this.name == "edge-agent-sdk") {
apply(plugin = "org.gradle.maven-publish")
apply(plugin = "org.gradle.signing")

publishing {
repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username =
project.findProperty("sonatypeUsername") as String? ?: System.getenv("OSSRH_USERNAME")
password = project.findProperty("sonatypePassword") as String? ?: System.getenv("OSSRH_TOKEN")
}
}
}
publications {
withType<MavenPublication> {
groupId = publishedMavenId
artifactId = project.name
version = project.version.toString()
pom {
name.set("Edge Agent SDK")
description.set(" Edge Agent SDK - Kotlin Multiplatform (Android/JVM)")
url.set("https://docs.atalaprism.io/")
organization {
name.set("Hyperledger")
url.set("https://hyperledger.org/")
}
issueManagement {
system.set("Github")
url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("cristianIOHK")
name.set("Cristian Gonzalez")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
url.set("https://github.com/cristianIOHK")
}
developer {
id.set("hamada147")
name.set("Ahmed Moussa")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
url.set("https://github.com/hamada147")
}
developer {
id.set("elribonazo")
name.set("Javier Ribó")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("amagyar-iohk")
name.set("Allain Magyar")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("antonbaliasnikov")
name.set("Anton Baliasnikov")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("goncalo-frade-iohk")
name.set("Gonçalo Frade")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
}
scm {
connection.set("scm:git:git://hyperledger/identus-edge-agent-sdk-kmp.git")
developerConnection.set("scm:git:ssh://hyperledger/identus-edge-agent-sdk-kmp.git")
url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp")
}
}
if (System.getenv().containsKey("OSSRH_GPG_SECRET_KEY")) {
signing {
useInMemoryPgpKeys(
project.findProperty("signing.signingSecretKey") as String?
?: System.getenv("OSSRH_GPG_SECRET_KEY"),
project.findProperty("signing.signingSecretKeyPassword") as String?
?: System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD")
)
sign(this@withType)
}
}
}
}
}
}
}

nexusPublishing {
Expand Down
107 changes: 107 additions & 0 deletions edge-agent-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,107 @@ plugins {
id("com.android.library")
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.kover") version "0.7.6"
id("org.gradle.maven-publish")
id("org.gradle.signing")
}

publishing {
repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
}
}
publications {
withType<MavenPublication> {
artifactId = project.name
version = project.version.toString()
pom {
name.set("Edge Agent SDK")
description.set(" Edge Agent SDK - Kotlin Multiplatform (Android/JVM)")
url.set("https://docs.atalaprism.io/")
organization {
name.set("Hyperledger")
url.set("https://hyperledger.org/")
}
issueManagement {
system.set("Github")
url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("cristianIOHK")
name.set("Cristian Gonzalez")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
url.set("https://github.com/cristianIOHK")
}
developer {
id.set("hamada147")
name.set("Ahmed Moussa")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
url.set("https://github.com/hamada147")
}
developer {
id.set("elribonazo")
name.set("Javier Ribó")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("amagyar-iohk")
name.set("Allain Magyar")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("antonbaliasnikov")
name.set("Anton Baliasnikov")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("goncalo-frade-iohk")
name.set("Gonçalo Frade")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
}
scm {
connection.set("scm:git:git://hyperledger/identus-edge-agent-sdk-kmp.git")
developerConnection.set("scm:git:ssh://hyperledger/identus-edge-agent-sdk-kmp.git")
url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp")
}
}
}
}
}

if (System.getenv().containsKey("OSSRH_GPG_SECRET_KEY")) {
signing {
useInMemoryPgpKeys(
System.getenv("OSSRH_GPG_SECRET_KEY"),
System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD")
)
sign(publishing.publications)
}
}

kover {
Expand Down Expand Up @@ -279,6 +380,12 @@ val buildProtoLibsGen: Task by tasks.creating {
}

afterEvaluate {
tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.withType<Sign>())
}
tasks.withType<PublishToMavenLocal> {
dependsOn(tasks.withType<Sign>())
}
tasks.getByName("runKtlintCheckOverCommonMainSourceSet") {
dependsOn(buildProtoLibsGen)
}
Expand Down

0 comments on commit c5903ff

Please sign in to comment.