@@ -469,49 +469,45 @@ jobs:
469469 uses : rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
470470 id : auth
471471
472- # Publish crates in dependency order with delays for crates.io indexing
473- - name : Publish inferadb-ledger-types
472+ # Publish crates in dependency order, polling crates.io index between each
473+ - name : Publish crates
474474 env :
475475 CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
476+ VERSION : ${{ needs.prepare.outputs.version }}
476477 run : |
477- cargo publish -p inferadb-ledger-types --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
478- echo "Waiting for crates.io to index..."
479- sleep 45
480-
481- - name : Publish inferadb-ledger-store
482- env :
483- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
484- run : |
485- cargo publish -p inferadb-ledger-store --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
486- echo "Waiting for crates.io to index..."
487- sleep 45
488-
489- - name : Publish inferadb-ledger-state
490- env :
491- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
492- run : |
493- cargo publish -p inferadb-ledger-state --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
494- echo "Waiting for crates.io to index..."
495- sleep 45
496-
497- - name : Publish inferadb-ledger-proto
498- env :
499- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
500- run : |
501- cargo publish -p inferadb-ledger-proto --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
502- echo "Waiting for crates.io to index..."
503- sleep 45
504-
505- - name : Publish inferadb-ledger-raft
506- env :
507- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
508- run : |
509- cargo publish -p inferadb-ledger-raft --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
510- echo "Waiting for crates.io to index..."
511- sleep 45
512-
513- - name : Publish inferadb-ledger-sdk
514- env :
515- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
516- run : |
517- cargo publish -p inferadb-ledger-sdk --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
478+ # Wait for a crate version to appear in the crates.io index.
479+ # Polls every 10s for up to 5 minutes before failing.
480+ wait_for_crate() {
481+ local crate="$1"
482+ local version="$2"
483+ local max_attempts=30
484+ local attempt=0
485+
486+ echo "Waiting for ${crate}@${version} to be indexed on crates.io..."
487+ while [ $attempt -lt $max_attempts ]; do
488+ if cargo search "${crate}" --limit 1 2>/dev/null | grep -q "^${crate} = \"${version}\""; then
489+ echo "${crate}@${version} is now available"
490+ return 0
491+ fi
492+ attempt=$((attempt + 1))
493+ echo " Attempt ${attempt}/${max_attempts} — not yet indexed, retrying in 10s..."
494+ sleep 10
495+ done
496+
497+ echo "ERROR: Timed out waiting for ${crate}@${version} to be indexed after $((max_attempts * 10))s"
498+ return 1
499+ }
500+
501+ CRATES=(inferadb-ledger-types inferadb-ledger-store inferadb-ledger-state inferadb-ledger-proto inferadb-ledger-raft inferadb-ledger-sdk)
502+ LAST_INDEX=$(( ${#CRATES[@]} - 1 ))
503+
504+ for i in "${!CRATES[@]}"; do
505+ crate="${CRATES[$i]}"
506+ echo "Publishing ${crate}..."
507+ cargo publish -p "${crate}" --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
508+
509+ # Wait for indexing before publishing the next crate (skip for last crate)
510+ if [ "$i" -lt "$LAST_INDEX" ]; then
511+ wait_for_crate "${crate}" "${VERSION}"
512+ fi
513+ done
0 commit comments