diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index b4fb59c..513a0eb 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -37,7 +37,9 @@ jobs: run: ./gradlew build - name: Publish package - run: ./gradlew publish + run: ./gradlew publishAllPublicationsToCentralPortal env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} diff --git a/README.md b/README.md index 293d3dd..ad02760 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Build](https://github.com/Bram--/bggclient/actions/workflows/ci.yml/badge.svg)](https://github.com/Bram--/bggclient/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/Bram--/bggclient/graph/badge.svg?token=FJDN8I5FR1)](https://codecov.io/gh/Bram--/bggclient) +[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Build](https://github.com/Bram--/bggclient/actions/workflows/ci.yml/badge.svg)](https://github.com/Bram--/bggclient/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/Bram--/bggclient/graph/badge.svg?token=FJDN8I5FR1)](https://codecov.io/gh/Bram--/bggclient) [![Maven Central](https://img.shields.io/maven-central/v/org.audux.bgg/bggclient.svg)](https://central.sonatype.com/artifact/org.audux.bgg/bggclient) # Board Game Geek Client/BGGClient @@ -35,15 +35,24 @@ A short summary of all available APIs/Endpoints available. ## Usage -TODO: Publish +The library is published on [MavenCentral as bggclient](https://central.sonatype.com/artifact/org.audux.bgg/bggclient) so using it is as simple as adding a single line to Gradle. ##### Gradle -TODO: Publish +```kotlin +implementation("org.audux.bgg:bggclient:0.5.1") +``` ##### Maven -TODO: Publish +```xml + + org.audux.bgg + bggclient + 0.5.0 + +``` + ## Examples diff --git a/build.gradle.kts b/build.gradle.kts index 0bd8421..8f4a981 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,8 +2,10 @@ plugins { jacoco `java-library` `maven-publish` + signing alias(libs.plugins.org.jetbrains.kotlin.jvm) alias(libs.plugins.ktfmt.gradle) + id("com.gradleup.nmcp").version("0.0.4") } java { @@ -13,14 +15,15 @@ java { publishing { publications { - create("maven") { + create("mavenJava") { groupId = "org.audux.bgg" artifactId = "bggclient" - version = "0.5.0" + version = "0.5.1" pom { name = "Unofficial JVM BGG client" - description = "Wrapper around the Board Game Geek's XML1 and XML2 APIs" + description = + "Library to fetch data from the Board game geek (XML) APIs. Usable in Java and Kotlin on the JVM or Android." url = "https://github.com/Bram--/bggclient" licenses { license { @@ -45,15 +48,24 @@ publishing { from(components["java"]) } } +} - repositories { - maven { - name = "OSSRH" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") - } +nmcp { + publish("mavenJava") { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + publicationType = "AUTOMATIC" + } +} + +signing { + if (project.gradle.startParameter.taskNames.contains("publishAllPublicationsToCentralPortal")) { + afterEvaluate { + useInMemoryPgpKeys( + System.getenv("GPG_SIGNING_KEY"), + System.getenv("GPG_SIGNING_PASSWORD") + ) + sign(publishing.publications["mavenJava"]) } } } diff --git a/examples/android/app/build.gradle.kts b/examples/android/app/build.gradle.kts index 6d86416..48b2404 100644 --- a/examples/android/app/build.gradle.kts +++ b/examples/android/app/build.gradle.kts @@ -68,7 +68,7 @@ dependencies { implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0") implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0") implementation("io.coil-kt:coil-compose:2.5.0") - implementation("org.audux.bgg:bggclient:0.5.0") + implementation("org.audux.bgg:bggclient:0.5.1") testImplementation("junit:junit:4.13.2") diff --git a/examples/java/build.gradle.kts b/examples/java/build.gradle.kts index 7ed9c32..a0b0b24 100644 --- a/examples/java/build.gradle.kts +++ b/examples/java/build.gradle.kts @@ -12,7 +12,7 @@ repositories { } dependencies { - implementation("org.audux.bgg:bggclient:0.5.0") + implementation("org.audux.bgg:bggclient:0.5.1") testImplementation(platform("org.junit:junit-bom:5.9.1")) testImplementation("org.junit.jupiter:junit-jupiter") diff --git a/examples/paginate/build.gradle.kts b/examples/paginate/build.gradle.kts index d297c23..62bfaad 100644 --- a/examples/paginate/build.gradle.kts +++ b/examples/paginate/build.gradle.kts @@ -20,7 +20,7 @@ application { } dependencies { - implementation("org.audux.bgg:bggclient:0.5.0") + implementation("org.audux.bgg:bggclient:0.5.1") testImplementation("org.jetbrains.kotlin:kotlin-test") }