From 8d699464f39a8c7ca9f04cd3842bb1ad1ec117e0 Mon Sep 17 00:00:00 2001 From: Todd Ginsberg Date: Mon, 29 Jul 2024 09:47:59 -0400 Subject: [PATCH] Publishing attempt --- .github/workflows/build.yml | 9 +++++++-- build.gradle.kts | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bf1aad..dd63e17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,5 +22,10 @@ jobs: distribution: 'temurin' cache: 'gradle' - - name: Build - run: ./gradlew build --no-daemon \ No newline at end of file + - name: Build and Publish + run: ./gradlew build publish --no-daemon + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} + SONATYPE_SIGNING_KEY: ${{ secrets.SONATYPE_SIGNING_KEY }} + SONATYPE_SIGNING_PASSPHRASE: ${{ secrets.SONATYPE_SIGNING_PASSPHRASE }} diff --git a/build.gradle.kts b/build.gradle.kts index c6a097f..686e008 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,11 @@ +import java.net.URI + plugins { id("com.adarshr.test-logger") version "4.0.0" id("jacoco") id("java-library") id("maven-publish") + id("signing") } description = "An extra set of helpful Stream Gatherers for Java" @@ -73,6 +76,21 @@ publishing { } } } + repositories { + maven { + url = if(version.toString().endsWith("-SNAPSHOT")) URI("https://oss.sonatype.org/content/repositories/snapshots/") + else URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_TOKEN") + } + } + } +} + +signing { + useInMemoryPgpKeys(System.getenv("SONATYPE_SIGNING_KEY"), System.getenv("SONATYPE_SIGNING_PASSPHRASE")) + sign(publishing.publications["gatherers4j"]) } tasks {