From c54a48ae86c2df765c50f2ebb9ed2314a15f113c Mon Sep 17 00:00:00 2001 From: Anton Baliasnikov Date: Thu, 7 Dec 2023 16:48:08 +0000 Subject: [PATCH] fix: add maven central publishing Signed-off-by: Anton Baliasnikov --- .github/workflows/release.yml | 5 +++ README.md | 3 +- build.gradle.kts | 63 +++++++++++++++++++++++++++++------ 3 files changed, 60 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4704251..2a5c48d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,6 +42,11 @@ jobs: GIT_COMMITTER_EMAIL: ${{ steps.import_gpg.outputs.email }} GIT_AUTHOR_NAME: ${{ steps.import_gpg.outputs.name }} GIT_COMMITTER_NAME: ${{ steps.import_gpg.outputs.name }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + BASE64_ARMORED_GPG_SIGNING_KEY_MAVEN: ${{ secrets.BASE64_ARMORED_GPG_SIGNING_KEY_MAVEN }} + # Password is empty string, no need to set it + SIGNING_KEY_PASSWORD: "" run: | npm install npx semantic-release diff --git a/README.md b/README.md index 32e24b8..fceb315 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# atala-automation +# Atala Automation + Common automation place for all Atala projects diff --git a/build.gradle.kts b/build.gradle.kts index 752e21d..82b077f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,12 @@ +import java.util.* + plugins { kotlin("jvm") version "1.8.21" `java-library` `maven-publish` id("io.gitlab.arturbosch.detekt") version "1.23.0" + id("io.github.gradle-nexus.publish-plugin") version "2.0.0-rc-1" + signing } group = "io.iohk.atala" @@ -44,17 +48,38 @@ java { publishing { publications { - create("maven") { + create(rootProject.name) { from(components["java"]) - } - } - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/input-output-hk/atala-automation") - credentials { - username = System.getenv("ATALA_GITHUB_ACTOR") - password = System.getenv("ATALA_GITHUB_TOKEN") + groupId = "io.iohk.atala" + artifactId = name + version = project.version.toString() + pom { + name.set("Atala PRISM Automation Helpers") + description.set("Automation helpers for PRISM identity ecosystem.") + url.set("https://docs.atalaprism.io/") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("amagyar-iohk") + name.set("Allain Magyar") + email.set("allain.magyar@iohk.io") + } + developer { + id.set("antonbaliasnikov") + name.set("Anton Baliasnikov") + email.set("anton.baliasnikov@iohk.io") + } + } + scm { + connection.set("scm:git:git://input-output-hk/atala-automation.git") + developerConnection.set("scm:git:ssh://input-output-hk/atala-automation.git") + url.set("https://github.com/input-output-hk/atala-automation") + } } } } @@ -68,3 +93,21 @@ detekt { buildUponDefaultConfig = true config.setFrom("detekt.yml") // point to your custom config defining rules to run, overwriting default behavior } + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/")) + username.set(System.getenv("SONATYPE_USERNAME")) + password.set(System.getenv("SONATYPE_PASSWORD")) + } + } +} + +signing { + val base64EncodedAsciiArmoredSigningKey: String = System.getenv("BASE64_ARMORED_GPG_SIGNING_KEY_MAVEN") ?: "" + val signingKeyPassword: String = System.getenv("SIGNING_KEY_PASSWORD") ?: "" + useInMemoryPgpKeys(String(Base64.getDecoder().decode(base64EncodedAsciiArmoredSigningKey.toByteArray())), signingKeyPassword) + sign(publishing.publications) +}