From 90602a68084007c7e4c39c488ef84a5e12b0f85f Mon Sep 17 00:00:00 2001 From: devcrocod Date: Fri, 18 Jul 2025 20:14:50 +0200 Subject: [PATCH 1/4] Update CI workflows configuration for debugging --- .github/workflows/gradle-publish.yml | 57 ++++++++++++++++++++++++---- build.gradle.kts | 11 +++--- gradle.properties | 6 +-- 3 files changed, 57 insertions(+), 17 deletions(-) diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index cf42b893..e5289444 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -9,7 +9,7 @@ name: Release on: release: - types: [created] + types: [ created ] jobs: build: @@ -27,12 +27,9 @@ jobs: with: java-version: '21' distribution: 'temurin' - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: JRELEASER_MAVENCENTRAL_USERNAME - server-password: JRELEASER_MAVENCENTRAL_PASSWORD - name: Setup Gradle - uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 + uses: gradle/actions/setup-gradle@v4 - name: Verify publication configuration run: ./gradlew jreleaserConfig @@ -53,8 +50,9 @@ jobs: JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - - name: Publish to OSSRH repository - run: ./gradlew publish jreleaserFullRelease + - name: Publish to Maven Central Portal + id: publish + run: ./gradlew publish jreleaserFullRelease --info --stacktrace -Djreleaser.verbose=true env: JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }} @@ -62,3 +60,48 @@ jobs: JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Query Central Portal for validation errors + if: failure() + shell: bash + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + run: | + set -euo pipefail + + DEPLOY_ID=$(grep '^deploymentId=' build/jreleaser/output.properties | cut -d= -f2) + echo "Portal deploymentId: $DEPLOY_ID" + + AUTH=$(printf "%s:%s" "$OSSRH_USERNAME" "$OSSRH_TOKEN" | base64) + echo "::add-mask::$AUTH" + + STATUS_JSON=$(curl -s \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json" \ + -X POST \ + "https://central.sonatype.com/api/v1/publisher/status?id=$DEPLOY_ID") + + echo "$STATUS_JSON" | jq . + + echo "$STATUS_JSON" | jq -r '.errors[]?.message' | + while read -r MSG; do + echo "::error title=Sonatype validation::$MSG" + done + + { + echo "### Sonatype Central Portal validation result" + echo + echo '```json' + echo "$STATUS_JSON" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + + - name: Upload JReleaser artefacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: jreleaser-logs + path: | + build/jreleaser/trace.log + build/jreleaser/output.properties \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d31409d9..908386aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,12 +40,12 @@ publishing { jreleaser { gitRootSearch = true - strict.set(true) + strict= true signing { - active.set(Active.ALWAYS) - armored.set(true) - artifacts.set(true) + active = Active.ALWAYS + armored = true + artifacts = true } deploy { @@ -138,13 +138,12 @@ fun MavenPom.configureMavenCentralMetadata() { } fun MavenPublication.signPublicationIfKeyPresent() { - val keyId = project.getSensitiveProperty("SIGNING_KEY_ID") val signingKey = project.getSensitiveProperty("SIGNING_KEY_PRIVATE") val signingKeyPassphrase = project.getSensitiveProperty("SIGNING_PASSPHRASE") if (!signingKey.isNullOrBlank()) { the().apply { - useInMemoryPgpKeys(keyId, signingKey, signingKeyPassphrase) + useInMemoryPgpKeys(signingKey, signingKeyPassphrase) sign(this@signPublicationIfKeyPresent) } diff --git a/gradle.properties b/gradle.properties index 74a401c1..7a184e54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,7 @@ kotlin.code.style=official -#org.gradle.jvmargs=-XX:+UseParallelGC -#org.gradle.parallel=true -#org.gradle.configuration-cache.parallel=true +org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 +org.gradle.parallel=true org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true From c063944b7c1c9142f4125b4644652292a4458a97 Mon Sep 17 00:00:00 2001 From: Pavel Gorgulov Date: Fri, 18 Jul 2025 20:25:10 +0200 Subject: [PATCH 2/4] Update .github/workflows/gradle-publish.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/gradle-publish.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index e5289444..987cbbe1 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -70,7 +70,17 @@ jobs: run: | set -euo pipefail - DEPLOY_ID=$(grep '^deploymentId=' build/jreleaser/output.properties | cut -d= -f2) + if [[ ! -f build/jreleaser/output.properties ]]; then + echo "::error title=File Missing::The file 'build/jreleaser/output.properties' does not exist." + exit 1 + fi + + DEPLOY_ID=$(grep '^deploymentId=' build/jreleaser/output.properties | cut -d= -f2 || true) + if [[ -z "$DEPLOY_ID" ]]; then + echo "::error title=Missing Deployment ID::The 'deploymentId' key was not found in 'build/jreleaser/output.properties'." + exit 1 + fi + echo "Portal deploymentId: $DEPLOY_ID" AUTH=$(printf "%s:%s" "$OSSRH_USERNAME" "$OSSRH_TOKEN" | base64) From 2da33e7092dc64bd8d9976ec806feac993b6e0b2 Mon Sep 17 00:00:00 2001 From: devcrocod Date: Mon, 21 Jul 2025 11:55:42 +0200 Subject: [PATCH 3/4] Refine Gradle and CI workflows for improved variable usage and error handling --- .github/workflows/gradle-publish.yml | 12 +++++++----- build.gradle.kts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 987cbbe1..8a098042 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -70,14 +70,16 @@ jobs: run: | set -euo pipefail - if [[ ! -f build/jreleaser/output.properties ]]; then - echo "::error title=File Missing::The file 'build/jreleaser/output.properties' does not exist." + OUTPUT_PROPS="build/jreleaser/output.properties" + + if [[ ! -f "$OUTPUT_PROPS" ]]; then + echo "::error title=File Missing::The file '$OUTPUT_PROPS' does not exist." exit 1 fi - DEPLOY_ID=$(grep '^deploymentId=' build/jreleaser/output.properties | cut -d= -f2 || true) + DEPLOY_ID=$(grep '^deploymentId=' "$OUTPUT_PROPS" | cut -d= -f2 || true) if [[ -z "$DEPLOY_ID" ]]; then - echo "::error title=Missing Deployment ID::The 'deploymentId' key was not found in 'build/jreleaser/output.properties'." + echo "::error title=Missing Deployment ID::The 'deploymentId' key was not found in '$OUTPUT_PROPS'." exit 1 fi @@ -86,7 +88,7 @@ jobs: AUTH=$(printf "%s:%s" "$OSSRH_USERNAME" "$OSSRH_TOKEN" | base64) echo "::add-mask::$AUTH" - STATUS_JSON=$(curl -s \ + STATUS_JSON=$(curl -sS \ -H "Authorization: Bearer $AUTH" \ -H "Content-Type: application/json" \ -X POST \ diff --git a/build.gradle.kts b/build.gradle.kts index 908386aa..723d0789 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,7 +40,7 @@ publishing { jreleaser { gitRootSearch = true - strict= true + strict = true signing { active = Active.ALWAYS From 50e5cb818c8d0f10a16247d54048c43e6be1ba53 Mon Sep 17 00:00:00 2001 From: devcrocod Date: Mon, 21 Jul 2025 12:45:07 +0200 Subject: [PATCH 4/4] Add validation for OSSRH credentials in Gradle publish workflow --- .github/workflows/gradle-publish.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 8a098042..2883e999 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -85,6 +85,16 @@ jobs: echo "Portal deploymentId: $DEPLOY_ID" + if [ -z "$OSSRH_USERNAME" ]; then + echo "::error title='OSSRH_USERNAME' is not set." + exit 1 + fi + + if [ -z "$OSSRH_TOKEN" ]; then + echo "::error title='OSSRH_TOKEN' is not set." + exit 1 + fi + AUTH=$(printf "%s:%s" "$OSSRH_USERNAME" "$OSSRH_TOKEN" | base64) echo "::add-mask::$AUTH"