From 5fe98a04e8ba0beb3ce165e96b42584cc84b07aa Mon Sep 17 00:00:00 2001 From: Ryan Brink <5607577+rgbrizzlehizzle@users.noreply.github.com> Date: Sun, 23 May 2021 13:47:48 -0400 Subject: [PATCH] Maven Central Here We Come!! (#60) --- .github/workflows/publish.yml | 3 +++ .github/workflows/release.yml | 26 ++++++++++++++++-- CHANGELOG.md | 10 +++++++ build.gradle.kts | 11 ++++++++ gradle.properties | 2 +- kompendium-auth/build.gradle.kts | 37 ++++++++++++++++++++++++++ kompendium-core/build.gradle.kts | 37 ++++++++++++++++++++++++++ kompendium-swagger-ui/build.gradle.kts | 37 ++++++++++++++++++++++++++ 8 files changed, 160 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d2276b853..8c4b6ae49 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,9 @@ name: Publish to GitHub Packages on: push: branches: [ main ] +env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} jobs: publish: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 394f33e3f..92b53a23d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,11 @@ on: types: - prereleased - released +env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} jobs: - publish: + publish-to-github: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -20,6 +23,25 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} restore-keys: ${{ runner.os }}-gradle - name: Publish packages to Github - run: ./gradlew publish -Prelease=true + run: ./gradlew publishAllPublicationsToGithubPackagesRepository -Prelease=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish-to-nexus: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: ${{ runner.os }}-gradle + - name: Publish packages to Github + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Prelease=true + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a635dd9a2..61ca21081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [1.2.2] - May 23rd, 2021 + +This is just to get my repo back to normal now that I have confirmed sonatype publish is happening + +## [1.2.0] - May 23rd, 2021 + +### Added + +- Finally, successfully pushed to Maven Central!!! + ## [1.1.0] - May 19th, 2021 ### Added diff --git a/build.gradle.kts b/build.gradle.kts index 677f7374e..5b4a91658 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("org.jetbrains.kotlin.jvm") version "1.5.0" apply false id("io.gitlab.arturbosch.detekt") version "1.17.0-RC3" apply false id("com.adarshr.test-logger") version "3.0.0" apply false + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" apply true } allprojects { @@ -63,5 +64,15 @@ allprojects { configure { withSourcesJar() + withJavadocJar() + } +} + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + } } } diff --git a/gradle.properties b/gradle.properties index b31c74d36..97603680e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Kompendium -project.version=1.1.0 +project.version=1.2.2 # Kotlin kotlin.code.style=official # Gradle diff --git a/kompendium-auth/build.gradle.kts b/kompendium-auth/build.gradle.kts index 5e106e1e6..40cb88efd 100644 --- a/kompendium-auth/build.gradle.kts +++ b/kompendium-auth/build.gradle.kts @@ -1,6 +1,7 @@ plugins { `java-library` `maven-publish` + signing } dependencies { @@ -18,6 +19,7 @@ dependencies { java { withSourcesJar() + withJavadocJar() } publishing { @@ -35,6 +37,41 @@ publishing { create("kompendium") { from(components["kotlin"]) artifact(tasks.sourcesJar) + artifact(tasks.javadocJar) + groupId = project.group.toString() + artifactId = project.name.toLowerCase() + version = project.version.toString() + + pom { + name.set("Kompendium") + description.set("A minimally invasive OpenAPI spec generator for Ktor") + url.set("https://github.com/bkbnio/Kompendium") + licenses { + license { + name.set("MIT License") + url.set("https://mit-license.org/") + } + } + developers { + developer { + id.set("bkbnio") + name.set("Ryan Brink") + email.set("admin@bkbn.io") + } + } + scm { + connection.set("scm:git:git://github.com/bkbnio/Kompendium.git") + developerConnection.set("scm:git:ssh://github.com/bkbnio/Kompendium.git") + url.set("https://github.com/bkbnio/Kompendium.git") + } + } } } } + +signing { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications) +} diff --git a/kompendium-core/build.gradle.kts b/kompendium-core/build.gradle.kts index a54119dd2..41f3d8ce8 100644 --- a/kompendium-core/build.gradle.kts +++ b/kompendium-core/build.gradle.kts @@ -1,6 +1,7 @@ plugins { `java-library` `maven-publish` + signing } dependencies { @@ -15,6 +16,7 @@ dependencies { java { withSourcesJar() + withJavadocJar() } publishing { @@ -32,6 +34,41 @@ publishing { create("kompendium") { from(components["kotlin"]) artifact(tasks.sourcesJar) + artifact(tasks.javadocJar) + groupId = project.group.toString() + artifactId = project.name.toLowerCase() + version = project.version.toString() + + pom { + name.set("Kompendium") + description.set("A minimally invasive OpenAPI spec generator for Ktor") + url.set("https://github.com/bkbnio/Kompendium") + licenses { + license { + name.set("MIT License") + url.set("https://mit-license.org/") + } + } + developers { + developer { + id.set("bkbnio") + name.set("Ryan Brink") + email.set("admin@bkbn.io") + } + } + scm { + connection.set("scm:git:git://github.com/bkbnio/Kompendium.git") + developerConnection.set("scm:git:ssh://github.com/bkbnio/Kompendium.git") + url.set("https://github.com/bkbnio/Kompendium.git") + } + } } } } + +signing { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications) +} diff --git a/kompendium-swagger-ui/build.gradle.kts b/kompendium-swagger-ui/build.gradle.kts index 2df1af199..b523ac8ed 100644 --- a/kompendium-swagger-ui/build.gradle.kts +++ b/kompendium-swagger-ui/build.gradle.kts @@ -1,6 +1,7 @@ plugins { `java-library` `maven-publish` + signing } dependencies { @@ -17,6 +18,7 @@ dependencies { java { withSourcesJar() + withJavadocJar() } publishing { @@ -34,6 +36,41 @@ publishing { create("kompendium") { from(components["kotlin"]) artifact(tasks.sourcesJar) + artifact(tasks.javadocJar) + groupId = project.group.toString() + artifactId = project.name.toLowerCase() + version = project.version.toString() + + pom { + name.set("Kompendium") + description.set("A minimally invasive OpenAPI spec generator for Ktor") + url.set("https://github.com/bkbnio/Kompendium") + licenses { + license { + name.set("MIT License") + url.set("https://mit-license.org/") + } + } + developers { + developer { + id.set("bkbnio") + name.set("Ryan Brink") + email.set("admin@bkbn.io") + } + } + scm { + connection.set("scm:git:git://github.com/bkbnio/Kompendium.git") + developerConnection.set("scm:git:ssh://github.com/bkbnio/Kompendium.git") + url.set("https://github.com/bkbnio/Kompendium.git") + } + } } } } + +signing { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications) +}