diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ac5a160..7258c112 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,13 +48,12 @@ jobs: - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - name: Publish to Maven Central run: | - ./gradlew publishAllPublicationsToStagingRepository - ./gradlew jreleaserDeploy --stacktrace + ./gradlew publishAggregationToCentralPortal env: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} - JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} - JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVENCENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVENCENTRAL_PASSWORD }} docker-build-push: name: Push Docker image diff --git a/build.gradle b/build.gradle index b873e3ac..af1ae99d 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,8 @@ plugins { id "com.github.ben-manes.versions" version "0.53.0" id "com.diffplug.spotless" version "8.0.0" + id "com.gradleup.nmcp.aggregation" version "1.2.0" + id "com.gradleup.nmcp" version "1.2.0" apply false } version = '2.5.8' @@ -22,6 +24,18 @@ if (properties.containsKey('NIGHTLY')) { ext.nightly = false } +nmcpAggregation { + centralPortal { + username = findProperty('mavenCentralUsername') + password = findProperty('mavenCentralPassword') + publishingType = "AUTOMATIC" + } +} + +dependencies { + nmcpAggregation(project(':fabric-chaincode-shim')) +} + allprojects { apply plugin: "com.diffplug.spotless" diff --git a/fabric-chaincode-shim/build.gradle b/fabric-chaincode-shim/build.gradle index 33b9f2f9..5aca7063 100644 --- a/fabric-chaincode-shim/build.gradle +++ b/fabric-chaincode-shim/build.gradle @@ -7,9 +7,9 @@ plugins { id 'maven-publish' id 'signing' - id 'org.jreleaser' version '1.20.0' id 'jacoco' id 'pmd' + id "com.gradleup.nmcp" } pmd { @@ -224,8 +224,8 @@ javadoc { def final stagingDeployUrl = layout.buildDirectory.dir('staging-deploy') publishing { - publications { - shim(MavenPublication) { + publications { + shim(MavenPublication) { groupId = project.group artifactId = project.name version = project.version @@ -261,16 +261,10 @@ publishing { } } } - } - - } - - repositories { - maven { - name = "Staging" - url = stagingDeployUrl } + } + repositories { maven { name = "GitHub" url = "https://maven.pkg.github.com/hyperledger/fabric-chaincode-java" @@ -283,34 +277,16 @@ publishing { } signing { - required = { gradle.taskGraph.hasTask(":${project.name}:publishShimPublicationToStagingRepository") } - def signingKey = findProperty('signingKey') def signingPassword = findProperty('signingPassword') useInMemoryPgpKeys(signingKey, signingPassword) - sign publishing.publications.shim -} - -jreleaser { - gitRootSearch = true - deploy { - maven { - mavenCentral { - sonatype { - active = 'ALWAYS' - url = 'https://central.sonatype.com/api/v1/publisher' - sign = false - stagingRepository(file(stagingDeployUrl).toString()) - } - } - } - } - release { - github { - enabled = false - } + required = { + gradle.taskGraph.hasTask(":${project.name}:publishShimPublicationToNmcpRepository") + || gradle.taskGraph.hasTask(":${project.name}:publishShimPublicationToGitHubRepository") } + + sign publishing.publications.shim } // Need to specify the sourcesJar task BEFORE the java{withSourcesJar()} so that it picks up the duplicatesStratergy