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

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