Skip to content

Update CI workflows configuration for debugging #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 72 additions & 7 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Release

on:
release:
types: [created]
types: [ created ]

jobs:
build:
Expand All @@ -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
Expand All @@ -53,12 +50,80 @@ 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 }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
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
11 changes: 5 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading