Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: generalize publishing setup #15471

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -835,7 +835,7 @@ jobs:
NEXUS_PASSWORD: ${{ secrets.sdk-ossrh-password }}
with:
gradle-version: ${{ inputs.gradle-version }}
arguments: "release${{ inputs.release-profile }} -PpublishingPackageGroup=com.swirlds --scan -PpublishSigningEnabled=true --no-configuration-cache"
arguments: "release${{ inputs.release-profile }} -PpublishingPackageGroup=com.swirlds -Ps01SonatypeHost=true -PpublishSigningEnabled=true --scan --no-configuration-cache"

- name: Gradle Publish Services to ${{ inputs.version-policy == 'specified' && 'Maven Central' || 'Google Artifact Registry' }} (${{ inputs.release-profile }})
uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3.1.0
Expand All @@ -845,7 +845,7 @@ jobs:
NEXUS_PASSWORD: ${{ secrets.svcs-ossrh-password }}
with:
gradle-version: ${{ inputs.gradle-version }}
arguments: "release${{ inputs.release-profile }} -PpublishingPackageGroup=com.hedera --scan -PpublishSigningEnabled=true --no-configuration-cache"
arguments: "release${{ inputs.release-profile }} -PpublishingPackageGroup=com.hedera.hashgraph -PpublishSigningEnabled=true --scan --no-configuration-cache"

- name: Upload SDK Release Archives
if: ${{ inputs.dry-run-enabled != true && inputs.version-policy == 'specified' && !cancelled() && !failure() }}
Expand Down
6 changes: 6 additions & 0 deletions developers.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is here for 'hapi', because that "product" is missing the toplevel folder
# (it contains the 'hapi' module directly)
[email protected]=Hedera Base Team
[email protected]=Hedera Services Team
[email protected]=Hedera Smart Contracts Team
[email protected]=Release Engineering Team
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
* limitations under the License.
*/

import java.util.Properties

plugins {
id("java")
id("maven-publish")
id("signing")
}

tasks.withType<PublishToMavenRepository>().configureEach {
// Publishing tasks are only enabled if we publish to the matching group.
// Otherwise, Nexus configuration and credentials do not fit.
val publishingPackageGroup = providers.gradleProperty("publishingPackageGroup").orNull
enabled = publishingPackageGroup == project.group
}

java {
withJavadocJar()
withSourcesJar()
Expand All @@ -42,32 +51,69 @@ val maven =
allVariants { fromResolutionResult() }
}

suppressAllPomMetadataWarnings()

pom {
packaging = findProperty("maven.project.packaging")?.toString() ?: "jar"
name.set(project.name)
url.set("https://www.swirlds.com/")
inceptionYear.set("2016")
val devGroups = Properties()
val developerProperties = layout.projectDirectory.file("../developers.properties")
devGroups.load(
providers
.fileContents(developerProperties)
.asText
.orElse(
provider {
throw RuntimeException("${developerProperties.asFile} does not exist")
}
)
.get()
.reader()
)

url = "https://www.hashgraph.com/"
inceptionYear = "2016"

description.set(provider(project::getDescription))
description =
providers
.fileContents(layout.projectDirectory.file("../description.txt"))
.asText
.orElse(provider { project.description })
.map { it.replace("\n", " ").trim() }
.orNull

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

val repoName = isolated.rootProject.name

issueManagement {
system = "GitHub"
url = "https://github.com/hashgraph/$repoName/issues"
}

licenses {
license {
name.set("Apache License, Version 2.0")
url.set(
"https://raw.githubusercontent.com/hashgraph/hedera-services/main/LICENSE"
)
name = "Apache License, Version 2.0"
url = "https://raw.githubusercontent.com/hashgraph/$repoName/main/LICENSE"
}
}

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")
connection = "scm:git:git://github.com/hashgraph/$repoName.git"
developerConnection = "scm:git:ssh://github.com:hashgraph/$repoName.git"
url = "https://github.com/hashgraph/$repoName"
}

developers {
devGroups.forEach { mail, team ->
developer {
name = team as String
email = mail as String
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ plugins {
id("io.github.gradle-nexus.publish-plugin")
}

val publishingPackageGroup = providers.gradleProperty("publishingPackageGroup").getOrElse("")
val isPlatformPublish = publishingPackageGroup == "com.swirlds"

nexusPublishing {
packageGroup = publishingPackageGroup
val s01SonatypeHost = providers.gradleProperty("s01SonatypeHost").getOrElse("false").toBoolean()
packageGroup = providers.gradleProperty("publishingPackageGroup").getOrElse("")

repositories {
sonatype {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
if (isPlatformPublish) {
if (s01SonatypeHost) {
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl =
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,50 +31,6 @@ if (
apply(plugin = "com.google.cloud.artifactregistry.gradle-plugin")
}

// Publishing tasks are only enabled if we publish to the matching group.
// Otherwise, Nexus configuration and credentials do not fit.
val publishingPackageGroup = providers.gradleProperty("publishingPackageGroup").getOrElse("")

tasks.withType<PublishToMavenRepository>().configureEach {
enabled = publishingPackageGroup == "com.swirlds"
}

publishing.publications.named<MavenPublication>("maven") {
pom.description =
"Swirlds is a software platform designed to build fully-distributed " +
"applications that harness the power of the cloud without servers. " +
"Now you can develop applications with fairness in decision making, " +
"speed, trust and reliability, at a fraction of the cost of " +
"traditional server-based platforms."

pom.developers {
developer {
name = "Platform Base Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Platform Hashgraph Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Platform Data Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Release Engineering Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
}
}

publishing.repositories {
maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-prerelease-channel") {
name = "prereleaseChannel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,3 @@ plugins {
id("java")
id("com.hedera.gradle.maven-publish")
}

// Publishing tasks are only enabled if we publish to the matching group.
// Otherwise, Nexus configuration and credentials do not fit.
val publishingPackageGroup = providers.gradleProperty("publishingPackageGroup").getOrElse("")

tasks.withType<PublishToMavenRepository>().configureEach {
enabled = publishingPackageGroup == "com.hedera"
}

publishing {
publications {
named<MavenPublication>("maven") {
pom.developers {
developer {
name = "Hedera Base Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Hedera Services Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Hedera Smart Contracts Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
developer {
name = "Release Engineering Team"
email = "[email protected]"
organization = "Hedera Hashgraph"
organizationUrl = "https://www.hedera.com"
}
}
}
}
}
4 changes: 4 additions & 0 deletions hedera-node/developers.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hedera-base@hashgraph.com=Hedera Base Team
hedera-services@hashgraph.com=Hedera Services Team
hedera-smart-contracts@hashgraph.com=Hedera Smart Contracts Team
release-engineering@hashgraph.com=Release Engineering Team
3 changes: 3 additions & 0 deletions platform-sdk/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Swirlds is a software platform designed to build fully-distributed applications that harness the power of the cloud
without servers. Now you can develop applications with fairness in decision making, speed, trust and reliability, at
a fraction of the cost of traditional server-based platforms.
4 changes: 4 additions & 0 deletions platform-sdk/developers.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
platform-base@hashgraph.com=Platform Base Team
platform-hashgraph@hashgraph.com=Platform Hashgraph Team
platform-data@hashgraph.com=Platform Data Team
release-engineering@hashgraph.com=Release Engineering Team
Loading