|
33 | 33 | echo "Get the latest release version" |
34 | 34 | LATEST_VERSION=$(curl -s https://api.github.com/repos/modelcontextprotocol/registry/releases/latest | jq -r '.tag_name') |
35 | 35 | echo "Installing MCP Publisher version: $LATEST_VERSION" |
36 | | - echo "Download and extract the latest release" |
37 | 36 | curl -L "https://github.com/modelcontextprotocol/registry/releases/download/${LATEST_VERSION}/mcp-publisher_${LATEST_VERSION#v}_${OS}_${ARCH}.tar.gz" \ |
38 | 37 | | tar xz mcp-publisher |
39 | 38 |
|
|
45 | 44 | - name: Publish server.json to MCP Registry |
46 | 45 | run: | |
47 | 46 | echo "Publish server.json to MCP Registry" |
48 | | - ./mcp-publisher publish |
| 47 | + # Try to publish, with fallback for duplicate version |
| 48 | + if ./mcp-publisher publish; then |
| 49 | + echo "Successfully published to MCP Registry" |
| 50 | + else |
| 51 | + PUBLISH_EXIT_CODE=$? |
| 52 | + echo "Publish failed with exit code: $PUBLISH_EXIT_CODE" |
| 53 | + |
| 54 | + # Check if it's a duplicate version error |
| 55 | + if [ $PUBLISH_EXIT_CODE -ne 0 ]; then |
| 56 | + echo "Checking if version already exists in registry..." |
| 57 | + |
| 58 | + # Get current version from server.json |
| 59 | + CURRENT_VERSION=$(jq -r '.version' server.json) |
| 60 | + echo "Current version: $CURRENT_VERSION" |
| 61 | + |
| 62 | + # Check if version exists in registry |
| 63 | + if curl -s "https://registry.modelcontextprotocol.io/v0/servers/io.github.robotmcp/ros-mcp-server" | jq -e ".version == \"$CURRENT_VERSION\"" > /dev/null; then |
| 64 | + echo "Version $CURRENT_VERSION already exists in registry. Skipping publication." |
| 65 | + echo "Server is already published with version $CURRENT_VERSION" |
| 66 | + else |
| 67 | + echo "Publication failed for unknown reason" |
| 68 | + exit $PUBLISH_EXIT_CODE |
| 69 | + fi |
| 70 | + fi |
| 71 | + fi |
0 commit comments