From fa30faf1417f85fc81f8b21bca722c41046cf83e Mon Sep 17 00:00:00 2001 From: Manik Magar Date: Sun, 19 Feb 2023 19:43:09 -0500 Subject: [PATCH 1/4] chore: maven central deploy workflow --- .github/workflows/build.yml | 25 +++++++++++++++++-------- build.gradle | 22 +++++++++++++++++----- version.properties | 4 ++-- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 553d7775..7258d890 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,16 +44,25 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} files: ./**/build/test-results/test/*.xml +# - name: Maven Deploy and Release +# if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' +# env: +# JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} +# JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} +# JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }} +# JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} +# JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} +# JRELEASER_NEXUS2_USERNAME: ${{ secrets.OSSRH_USERNAME }} +# run: ./gradlew publish jreleaserFullRelease + - name: Maven Deploy and Release - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' + if: github.event_name != 'pull_request' env: - JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} - JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }} - JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - JRELEASER_NEXUS2_USERNAME: ${{ secrets.OSSRH_USERNAME }} - run: ./gradlew publish jreleaserFullRelease + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: ./gradlew publish - name: Tag Release if: ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'}} diff --git a/build.gradle b/build.gradle index 5080d59c..88451d2b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,16 +3,24 @@ plugins { id 'base' id 'net.thauvin.erik.gradle.semver' version '1.0.4' id 'org.jreleaser' version '1.4.0' + id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' } jreleaser { configFile = 'jreleaser.yml' } +nexusPublishing { + repositories { + sonatype() + } +} + subprojects { apply plugin: 'groovy' apply plugin: 'java' apply plugin: 'maven-publish' + apply plugin: 'signing' apply plugin: 'net.thauvin.erik.gradle.semver' group 'com.avioconsulting.mule' @@ -108,10 +116,14 @@ subprojects { } } } - repositories { - maven { - url = layout.getBuildDirectory().dir("staging-deploy") - } - } +// repositories { +// maven { +// url = layout.getBuildDirectory().dir("staging-deploy") +// } +// } + } + + signing { + sign publishing.publications.maven } } diff --git a/version.properties b/version.properties index 00d320db..a2c8f53d 100644 --- a/version.properties +++ b/version.properties @@ -4,5 +4,5 @@ version.buildmeta= version.major=1 version.minor=0 version.patch=1 -version.prerelease= -version.semver=1.0.1 +version.prerelease=SNAPSHOT +version.semver=1.0.1-SNAPSHOT From 8bf8857786ff8b36802ff514c996ae962f5517cf Mon Sep 17 00:00:00 2001 From: Manik Magar Date: Sun, 19 Feb 2023 20:16:11 -0500 Subject: [PATCH 2/4] configure signing key --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index 88451d2b..1bdd52ca 100644 --- a/build.gradle +++ b/build.gradle @@ -124,6 +124,9 @@ subprojects { } signing { + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.maven } } From 03cca2c6c35364ac00f8b5500d5c5f10e453a963 Mon Sep 17 00:00:00 2001 From: Manik Magar Date: Sun, 19 Feb 2023 20:24:33 -0500 Subject: [PATCH 3/4] close and release sonatype --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7258d890..f966b7ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - run: ./gradlew publish + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository - name: Tag Release if: ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'}} From e6bb8efa0f34e0b67fca111824afe97aee93dab1 Mon Sep 17 00:00:00 2001 From: Manik Magar Date: Sun, 19 Feb 2023 20:32:33 -0500 Subject: [PATCH 4/4] publish from master only --- .github/workflows/build.yml | 2 +- build.gradle | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f966b7ce..b15ea143 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: # run: ./gradlew publish jreleaserFullRelease - name: Maven Deploy and Release - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' env: ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} diff --git a/build.gradle b/build.gradle index 1bdd52ca..4308de1e 100644 --- a/build.gradle +++ b/build.gradle @@ -2,13 +2,13 @@ plugins { id 'base' id 'net.thauvin.erik.gradle.semver' version '1.0.4' - id 'org.jreleaser' version '1.4.0' +// id 'org.jreleaser' version '1.4.0' id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' } - -jreleaser { - configFile = 'jreleaser.yml' -} +// +//jreleaser { +// configFile = 'jreleaser.yml' +//} nexusPublishing { repositories {