From fa2350d7bf05f45e5df9bc5c09a989b7faf9c338 Mon Sep 17 00:00:00 2001 From: Vladimir Orany Date: Fri, 17 Sep 2021 12:45:40 +0200 Subject: [PATCH] publishing to Maven Central --- .../workflows/gradle-versions-watchdog.yml | 2 +- .github/workflows/gradle.yml | 2 +- .github/workflows/release.yml | 35 +++++++++----- README.md | 2 +- build.gradle | 46 +++++++++---------- gradle.properties | 3 +- settings.gradle | 17 ++++--- 7 files changed, 60 insertions(+), 47 deletions(-) diff --git a/.github/workflows/gradle-versions-watchdog.yml b/.github/workflows/gradle-versions-watchdog.yml index b0ecdb3..3764b07 100644 --- a/.github/workflows/gradle-versions-watchdog.yml +++ b/.github/workflows/gradle-versions-watchdog.yml @@ -13,7 +13,7 @@ jobs: CI: true steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up JDK 1.8 uses: actions/setup-java@v1 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1a88e99..e510823 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -29,7 +29,7 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up JDK 1.8 uses: actions/setup-java@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2192dde..06109a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,17 +10,29 @@ jobs: env: GRADLE_OPTS: "-Xmx6g -Xms4g" steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Semantic Version - id: version - uses: ncipollo/semantic-version-action@v1 - - uses: eskatos/gradle-command-action@v1 - with: - arguments: gitPublishPush bintrayUpload -PbintrayUsername=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} -Pversion=${{ steps.version.outputs.tag }} -Prelease=true -Dorg.ajoberstar.grgit.auth.username=${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }} --stacktrace + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Semantic Version + id: version + uses: ncipollo/semantic-version-action@v1 + - name: Decode PGP + id: write_file + uses: timheuer/base64-to-file@v1 + with: + fileName: 'secret.pgp' + encodedString: ${{ secrets.SIGNING_SECRET_KEY_BASE64 }} + - uses: eskatos/gradle-command-action@v1 + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_SECRET_KEY_PATH: ${{ steps.write_file.outputs.filePath }} + with: + arguments: gitPublishPush publishToSonatype closeAndReleaseSonatypeStagingRepository -Pversion=${{ steps.version.outputs.tag }} -Prelease=true -Dorg.ajoberstar.grgit.auth.username=${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }} --stacktrace ping: name: Notify Upstream Repositories runs-on: ubuntu-latest @@ -29,6 +41,7 @@ jobs: matrix: repository: - agorapulse/agorapulse-bom + - agorapulse/agorapulse-oss steps: - uses: actions/checkout@v1 - name: Semantic Version diff --git a/README.md b/README.md index 1341ba4..7ec2d52 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Micronaut Rethrow [![Build Status](https://github.com/agorapulse/micronaut-rethrow/workflows/Check/badge.svg)](https://github.com/agorapulse/micronaut-rethrow/actions) -[![Download](https://api.bintray.com/packages/agorapulse/libs/micronaut-rethrow/images/download.svg)](https://bintray.com/agorapulse/libs/micronaut-rethrow/_latestVersion) +[![Maven Central](https://img.shields.io/maven-central/v/com.agorapulse/micronaut-rethrow.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.agorapulse%22%20AND%20a:%22micronaut-rethrow%22) [![Coverage Status](https://coveralls.io/repos/github/agorapulse/micronaut-rethrow/badge.svg?branch=master)](https://coveralls.io/github/agorapulse/micronaut-rethrow?branch=master) Micronaut Rethrow Library diff --git a/build.gradle b/build.gradle index cdb4ac6..66a36f5 100644 --- a/build.gradle +++ b/build.gradle @@ -17,14 +17,17 @@ */ plugins { id 'org.kordamp.gradle.groovy-project' - id 'org.kordamp.gradle.bintray' id 'org.kordamp.gradle.checkstyle' id 'org.kordamp.gradle.codenarc' id 'org.kordamp.gradle.coveralls' + id 'io.github.gradle-nexus.publish-plugin' } -if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = '**UNDEFINED**' -if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = '**UNDEFINED**' +if (!project.hasProperty('ossrhUsername')) ext.ossrhUsername = System.getenv('SONATYPE_USERNAME') ?: '**UNDEFINED**' +if (!project.hasProperty('ossrhPassword')) ext.ossrhPassword = System.getenv('SONATYPE_PASSWORD') ?: '**UNDEFINED**' +if (!project.hasProperty('signingKeyId')) ext.signingKeyId = System.getenv('SIGNING_KEY_ID') ?: '**UNDEFINED**' +if (!project.hasProperty('signingPassword')) ext.signingPassword = System.getenv('SIGNING_PASSWORD') ?: '**UNDEFINED**' +if (!project.hasProperty('signingSecretKey')) ext.signingSecretKey = System.getenv('SIGNING_SECRET_KEY_PATH') ? rootProject.file(System.getenv('SIGNING_SECRET_KEY_PATH')).text : '**UNDEFINED**' config { release = (rootProject.findProperty('release') ?: false).toBoolean() @@ -69,23 +72,17 @@ config { } publishing { - signing = false + enabled = false + signing { + enabled = true + keyId = signingKeyId + secretKey = signingSecretKey + password = signingPassword + } releasesRepository = 'localRelease' snapshotsRepository = 'localSnapshot' } - bintray { - credentials { - username = bintrayUsername - password = bintrayApiKey - } - // TODO: replace - userOrg = 'agorapulse' - repo = 'libs' - name = 'micronaut-rethrow' - publish = true - } - quality { checkstyle { toolVersion = '8.27' @@ -107,6 +104,15 @@ config { } +nexusPublishing { + repositories { + sonatype { + username = ossrhUsername + password = ossrhPassword + } + } +} + allprojects { repositories { mavenCentral() @@ -128,12 +134,6 @@ projects { mavenCentral() } - config { - bintray { - name = subproject.name - } - } - // location independent tests (useful for stable CI builds) tasks.withType(Test){ systemProperty 'user.timezone', 'UTC' @@ -178,7 +178,7 @@ projects { } config { - bintray { + publishing { enabled = true } } diff --git a/gradle.properties b/gradle.properties index b53fab5..35e34bc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,8 @@ slug=agorapulse/micronaut-rethrow group=com.agorapulse version=1.0.0-SNAPSHOT -kordampPluginVersion=0.44.0 +kordampPluginVersion=0.46.0 +nexusPluginVersion=1.0.0 gitPublishPluginVersion=2.1.3 groovyVersion=2.5.14 diff --git a/settings.gradle b/settings.gradle index 22f4c0b..ac617ba 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,19 +17,18 @@ */ buildscript { repositories { - jcenter() mavenCentral() gradlePluginPortal() } dependencies { - classpath group: 'org.kordamp.gradle', name: 'settings-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'groovy-project-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'bintray-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'checkstyle-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'codenarc-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'guide-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.kordamp.gradle', name: 'coveralls-gradle-plugin', version: kordampPluginVersion - classpath group: 'org.ajoberstar', name: 'gradle-git-publish', version: gitPublishPluginVersion + classpath group: 'org.kordamp.gradle', name: 'settings-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.kordamp.gradle', name: 'groovy-project-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.kordamp.gradle', name: 'checkstyle-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.kordamp.gradle', name: 'codenarc-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.kordamp.gradle', name: 'guide-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.kordamp.gradle', name: 'coveralls-gradle-plugin', version: kordampPluginVersion + classpath group: 'org.ajoberstar', name: 'gradle-git-publish', version: gitPublishPluginVersion + classpath group: 'io.github.gradle-nexus', name: 'publish-plugin', version: nexusPluginVersion } }