From 3dc0ed1531bcc64b4a0016013722c690fb492853 Mon Sep 17 00:00:00 2001 From: Dmitrii Duzhinskii Date: Thu, 31 Aug 2023 16:17:29 +0300 Subject: [PATCH] Publishing to sonatype --- .github/workflows/publish-gh.yml | 17 ++++++++--- build.gradle.kts | 4 +-- options/build.gradle.kts | 52 ++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-gh.yml b/.github/workflows/publish-gh.yml index f80963f..14c389d 100644 --- a/.github/workflows/publish-gh.yml +++ b/.github/workflows/publish-gh.yml @@ -1,6 +1,6 @@ -name: Publish to GitHub packages +name: Publish packages -on: [release] +on: [ release ] jobs: publish: @@ -16,7 +16,16 @@ jobs: with: distribution: 'zulu' java-version: 17 + - name: Get gpg keys + run: | + echo '${{secrets.MVN_GPG_ENCRYPTED}}' | base64 -d > publish_key.gpg + gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.MVN_GPG_PASS}}" \ + --output secret.gpg publish_key.gpg + - name: Get release version + run: echo "::set-env name=RELEASE_VERSION::${GITHUB_REF:11}" - name: Publish gradle - run: ./gradlew publish + run: ./gradlew publish -Psigning.keyId=${{secrets.MVN_GPG_KEYID}} -Psigning.secretKeyRingFile=secret.gpg -Psigning.password=${{secrets.MVN_GPG_PASS}} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 4371ea6..159db9d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,8 +15,8 @@ tasks.test { allprojects { - group = "org.sudu" - version = "0.1" + group = "io.github.suduide" + version = "0.0.1" apply(plugin = "java-library") apply(plugin = "test-report-aggregation") diff --git a/options/build.gradle.kts b/options/build.gradle.kts index 111b700..beb61b2 100644 --- a/options/build.gradle.kts +++ b/options/build.gradle.kts @@ -1,11 +1,54 @@ plugins { id("com.google.protobuf") version "0.9.1" `maven-publish` + signing +} + +java { + withJavadocJar() + withSourcesJar() +} + +signing { + sign(publishing.publications) } publishing { publications { create("maven") { + pom { + + description = "Options for protogen tool. Use it as protogen scope dependency" + name = "protogen-options" + url = "https://github.com/SuduIDE/protogen" + organization { + name = "com.github.SuduIDE" + url = "https://github.com/SuduIDE" + } + issueManagement { + system = "GitHub" + url = "https://github.com/SuduIDE/protogen/issues" + } + licenses { + license { + name = "The Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + scm { + url = "https://github.com/SuduIDE/protogen" + connection = "scm:https://github.com/SuduIDE/protogen.git" + developerConnection = "scm:git://github.com/SuduIDE/protogen.git" + } + developers { + developer { + id = "Duzhinsky" + name = "Dmitrii Duzhinskii" + email = "dduzhinsky@ya.ru" + } + } + } + groupId = project.group.toString() artifactId = "protogen-options" version = project.version.toString() @@ -13,6 +56,7 @@ publishing { from(components["java"]) } } + repositories { maven { name = "ghPackages" @@ -22,6 +66,14 @@ publishing { password = System.getenv("GITHUB_TOKEN") } } + maven { + name = "sonatype" + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") + credentials { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + } + } } }