Files
AndroidJava/devbricksx-android/completeMavenCentralStaging.sh
coco 7846a45f2c a
2026-07-03 15:47:27 +08:00

28 lines
862 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
NEXUS_USER=$(grep '^NEXUS_USER=' private.properties | cut -d'=' -f2-)
NEXUS_PASS=$(grep '^NEXUS_PASS=' private.properties | cut -d'=' -f2-)
OSSRH_API_URL="https://ossrh-staging-api.central.sonatype.com"
ENDPOINT_SEARCH="manual/search/repositories"
ENDPOINT_UPLOAD="manual/upload/repository"
AUTH="${NEXUS_USER}:${NEXUS_PASS}"
ENCODED=$(printf "%s" "$AUTH" | base64)
echo "Base64: $ENCODED"
RESPONSE=$(curl -s -H "Authorization: Bearer ${ENCODED}" \
"${OSSRH_API_URL}/${ENDPOINT_SEARCH}")
KEY=$(echo "$RESPONSE" | sed 's/},{/}\n{/g' | grep '"state":"open"' | sed -n 's/.*"key":"\([^"]*\)".*/\1/p')
echo "Repository Key: $KEY"
if [ -z "$KEY" ]; then
echo "ERRORNo 'open' repository found。"
echo "RESP: $RESPONSE"
exit 1
fi
curl -H "Authorization: Bearer ${ENCODED}" \
-i -X POST "${OSSRH_API_URL}/${ENDPOINT_UPLOAD}/${KEY}" -v