Update CI workflows configuration for debugging (#172)

* Update CI workflows configuration for debugging

* Update .github/workflows/gradle-publish.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refine Gradle and CI workflows for improved variable usage and error handling

* Add validation for OSSRH credentials in Gradle publish workflow

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Pavel Gorgulov 2025-07-21 13:14:07 +02:00 • committed by GitHub
commit da9def95c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 79 additions and 17 deletions

View file

@ -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,70 @@ 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
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=' "$OUTPUT_PROPS" | cut -d= -f2 || true)
if [[ -z "$DEPLOY_ID" ]]; then
echo "::error title=Missing Deployment ID::The 'deploymentId' key was not found in '$OUTPUT_PROPS'."
exit 1
fi
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"
STATUS_JSON=$(curl -sS \
-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

View file

@ -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<SigningExtension>().apply {
useInMemoryPgpKeys(keyId, signingKey, signingKeyPassphrase)
useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
sign(this@signPublicationIfKeyPresent)
}

View file

@ -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