Context7 Platform -- Up-to-date docs for AI agents
CTX7-3078: Retry MCP Registry publish until npm serves the version (#3336)
Enes Gules374b2d5e400d
diff --git a/.github/dependabot.yml b/.github/dependabot.ymlindex 5276f380..d72e4c59 100644--- a/.github/dependabot.yml+++ b/.github/dependabot.yml@@ -5,7 +5,7 @@ updates:schedule:interval: monthly- package-ecosystem: docker- directory: /+ directory: /packages/mcpschedule:interval: monthly- package-ecosystem: github-actionsdiff --git a/.github/workflows/mcp-registry.yml b/.github/workflows/mcp-registry.ymlindex 0d9ffc6d..8adae649 100644--- a/.github/workflows/mcp-registry.yml+++ b/.github/workflows/mcp-registry.yml@@ -66,20 +66,24 @@ jobs:run: |curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher- - name: Login to MCP Registry- run: ./mcp-publisher login github-oidc-- name: Publish to MCP Registry- # Retry to tolerate npm propagation delay when chained after a release+ # npm can take several minutes to serve a new version after a release,+ # and the registry rejects the publish until it does. Retry that case+ # for up to 10 minutes; fail fast on any other error. Log in before+ # every attempt: the registry token expires after 5 minutes.run: |- for i in 1 2 3; do+ for i in $(seq 1 20); do+ ./mcp-publisher login github-oidcOUT=$(./mcp-publisher publish 2>&1) && { echo "$OUT"; exit 0; }echo "$OUT"if echo "$OUT" | grep -q "duplicate version"; thenecho "This version is already in the registry (versions are immutable) — nothing to do."exit 0fi- echo "Publish failed (attempt $i), retrying in 30s..."+ if ! echo "$OUT" | grep -q "was not found"; then+ exit 1+ fi+ echo "npm does not serve this version yet (${SECONDS}s elapsed, attempt $i/20), retrying in 30s..."sleep 30doneexit 1