Skip to content

Commit da93d5f

Browse files
committed
Finalize Central deployment after publish workflow
1 parent 1ed7e60 commit da93d5f

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,30 @@ jobs:
4848
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
4949
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
5050
run: ./gradlew --no-daemon --configuration-cache publish
51+
52+
- name: Finalize Deployment In Central Portal
53+
shell: bash
54+
env:
55+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
57+
run: |
58+
NAMESPACE=$(grep '^group=' gradle.properties | cut -d= -f2)
59+
if [ -z "${NAMESPACE}" ]; then
60+
echo "Unable to resolve namespace from gradle.properties group."
61+
exit 1
62+
fi
63+
64+
RESPONSE=$(curl -sS -w '\n%{http_code}' \
65+
-u "${OSSRH_USERNAME}:${OSSRH_PASSWORD}" \
66+
-X POST \
67+
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${NAMESPACE}?publishing_type=automatic")
68+
BODY=$(echo "${RESPONSE}" | sed '$d')
69+
STATUS=$(echo "${RESPONSE}" | tail -n 1)
70+
71+
echo "Central finalize HTTP status: ${STATUS}"
72+
echo "${BODY}"
73+
74+
if [ "${STATUS}" -lt 200 ] || [ "${STATUS}" -ge 300 ]; then
75+
echo "Failed to finalize deployment in Central Portal."
76+
exit 1
77+
fi

docs/release-checklist.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ Use this checklist before creating a release tag (`vX.Y.Z`).
4545
- Bump `gradle.properties` version to next snapshot (for example `X.Y.(Z+1)-SNAPSHOT`).
4646
- Add release notes entry (GitHub release and changelog link).
4747
- Smoke test the sample project with the published version.
48+
- Verify Central Portal deployment visibility:
49+
- `Publish` workflow should call the `manual/upload/defaultRepository/<namespace>` finalize API.
50+
- Confirm `central.sonatype.com/publishing/deployments` shows the component and reaches `Published`.

0 commit comments

Comments
 (0)