@@ -74,17 +74,16 @@ jobs:
7474 run : |
7575 VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
7676 echo "Searching for open repo..."
77- # Try to find the specific repo that contains our thin component
78- COMP=$(curl -s -u "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" \
79- "https://ossrh-staging-api.central.sonatype.com/manual/search/components?namespace=com.databricks&name=databricks-jdbc-thin&version=${VERSION}")
80- KEY=$(echo "$COMP" | grep -o '"repository"\s*:\s*"[^"]*"' | head -1 | cut -d':' -f2 | tr -d '" ')
81- if [ -z "$KEY" ]; then
82- # Fallback to newest open repository (least reliable)
83- RESP=$(curl -s -u "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" \
84- "https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?state=open")
85- KEY=$(echo "$RESP" | grep -o '"key":"[^"]*"' | tail -1 | cut -d':' -f2 | tr -d '"')
86- fi
87- if [ -z "$KEY" ]; then echo "No open repo found"; echo "$RESP"; exit 1; fi
77+ # Poll up to ~60s for the specific repo that contains our thin component to avoid publishing the wrong repo
78+ KEY=""
79+ for i in $(seq 1 12); do
80+ COMP=$(curl -s -u "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" \
81+ "https://ossrh-staging-api.central.sonatype.com/manual/search/components?namespace=com.databricks&name=databricks-jdbc-thin&version=${VERSION}")
82+ KEY=$(echo "$COMP" | grep -o '"repository"\s*:\s*"[^"]*"' | head -1 | cut -d':' -f2 | tr -d '" ')
83+ if [ -n "$KEY" ]; then break; fi
84+ echo "Waiting for component to be indexed... ($i/12)"; sleep 5;
85+ done
86+ if [ -z "$KEY" ]; then echo "Could not find repository containing databricks-jdbc-thin:${VERSION}"; echo "$COMP"; exit 1; fi
8887 echo "Publishing repo $KEY..."
8988 curl -s -X POST -u "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" \
9089 "https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/${KEY}?publishing_type=user_managed" | cat
0 commit comments