Skip to content

Commit

Permalink
chore: simplify Gradle signing setup (#10051)
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
  • Loading branch information
jjohannes committed Nov 21, 2023
1 parent 170a0a3 commit d68df70
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node-zxc-build-release-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ jobs:
OSSRH_PASSWORD: ${{ secrets.svcs-ossrh-password }}
with:
gradle-version: ${{ inputs.gradle-version }}
arguments: "releaseEvmMavenCentral --scan -PpublishSigningEnabled=true --no-configuration-cache"
arguments: "releaseEvmMavenCentral --scan -PpublishSigningEnabled=true"

- name: Gradle Maven Central Snapshot
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
Expand All @@ -620,7 +620,7 @@ jobs:
OSSRH_PASSWORD: ${{ secrets.svcs-ossrh-password }}
with:
gradle-version: ${{ inputs.gradle-version }}
arguments: "releaseEvmMavenCentralSnapshot --scan -PpublishSigningEnabled=true --no-configuration-cache"
arguments: "releaseEvmMavenCentralSnapshot --scan -PpublishSigningEnabled=true"

sdk-publish:
name: Publish Platform to ${{ inputs.version-policy == 'specified' && 'Maven Central' || 'GCP Registry' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,50 @@ java {
withSourcesJar()
}

publishing {
publications {
create<MavenPublication>("maven") {
from(components.getByName("java"))
versionMapping {
usage("java-api") { fromResolutionResult() }
usage("java-runtime") { fromResolutionResult() }
}

pom {
packaging = findProperty("maven.project.packaging")?.toString() ?: "jar"
name.set(project.name)
url.set("https://www.swirlds.com/")
inceptionYear.set("2016")
val maven =
publishing.publications.create<MavenPublication>("maven") {
from(components.getByName("java"))
versionMapping {
usage("java-api") { fromResolutionResult() }
usage("java-runtime") { fromResolutionResult() }
}

description.set(provider(project::getDescription))
pom {
packaging = findProperty("maven.project.packaging")?.toString() ?: "jar"
name.set(project.name)
url.set("https://www.swirlds.com/")
inceptionYear.set("2016")

organization {
name.set("Hedera Hashgraph, LLC")
url.set("https://www.hedera.com")
}
description.set(provider(project::getDescription))

licenses {
license {
name.set("Apache License, Version 2.0")
url.set(
"https://raw.githubusercontent.com/hashgraph/hedera-services/main/LICENSE"
)
}
}
organization {
name.set("Hedera Hashgraph, LLC")
url.set("https://www.hedera.com")
}

scm {
connection.set("scm:git:git://github.com/hashgraph/hedera-services.git")
developerConnection.set(
"scm:git:ssh://github.com:hashgraph/hedera-services.git"
licenses {
license {
name.set("Apache License, Version 2.0")
url.set(
"https://raw.githubusercontent.com/hashgraph/hedera-services/main/LICENSE"
)
url.set("https://github.com/hashgraph/hedera-services")
}
}

scm {
connection.set("scm:git:git://github.com/hashgraph/hedera-services.git")
developerConnection.set("scm:git:ssh://github.com:hashgraph/hedera-services.git")
url.set("https://github.com/hashgraph/hedera-services")
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications.getByName("maven"))
}
val publishSigningEnabled =
providers.gradleProperty("publishSigningEnabled").getOrElse("false").toBoolean()

tasks.withType<Sign>().configureEach {
onlyIf { providers.gradleProperty("publishSigningEnabled").getOrElse("false").toBoolean() }
if (publishSigningEnabled) {
signing {
sign(maven)
useGpgCmd()
}
}

0 comments on commit d68df70

Please sign in to comment.