|  | 
| 9 | 9 | 
 | 
| 10 | 10 | permissions: | 
| 11 | 11 |   contents: read | 
| 12 |  | -  id-token: write | 
| 13 | 12 | 
 | 
| 14 | 13 | jobs: | 
| 15 | 14 |   docker: | 
| 16 | 15 |     runs-on: ubuntu-latest | 
|  | 16 | +    permissions: | 
|  | 17 | +      id-token: write | 
| 17 | 18 |     steps: | 
| 18 | 19 |       - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | 
| 19 | 20 | 
 | 
|  | 
| 31 | 32 |             latest | 
| 32 | 33 |             ${{ steps.tag.outputs.version }} | 
| 33 | 34 |           push: true | 
|  | 35 | + | 
|  | 36 | +  mcp-registry: | 
|  | 37 | +    runs-on: ubuntu-latest | 
|  | 38 | +    needs: docker | 
|  | 39 | +    permissions: | 
|  | 40 | +      contents: read | 
|  | 41 | +      id-token: write | 
|  | 42 | +    steps: | 
|  | 43 | +      - name: Checkout code | 
|  | 44 | +        uses: actions/checkout@v5 | 
|  | 45 | +        with: | 
|  | 46 | +          fetch-depth: 0 | 
|  | 47 | + | 
|  | 48 | +      - name: Extract version from tag | 
|  | 49 | +        id: version | 
|  | 50 | +        run: | | 
|  | 51 | +          # Get the tag from the triggering workflow | 
|  | 52 | +          TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "") | 
|  | 53 | +          if [ -z "$TAG" ]; then | 
|  | 54 | +            echo "No tag found at HEAD" | 
|  | 55 | +            exit 1 | 
|  | 56 | +          fi | 
|  | 57 | +          echo "VERSION=$TAG" >> $GITHUB_OUTPUT | 
|  | 58 | +
 | 
|  | 59 | +      - name: Install dependencies | 
|  | 60 | +        run: | | 
|  | 61 | +          sudo apt-get update && sudo apt-get install -y jq | 
|  | 62 | +          curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.2.3/mcp-publisher_1.2.3_linux_amd64.tar.gz" | tar xz mcp-publisher | 
|  | 63 | +          chmod +x mcp-publisher | 
|  | 64 | +          sudo mv mcp-publisher /usr/local/bin/ | 
|  | 65 | +
 | 
|  | 66 | +      - name: Update server.json with Docker image | 
|  | 67 | +        run: | | 
|  | 68 | +          # Update the server.json with the correct Docker image reference | 
|  | 69 | +          # (note the image tag does not include the "v" prefix) | 
|  | 70 | +          jq --arg version "${{ steps.version.outputs.VERSION }}" \ | 
|  | 71 | +             --arg image "grafana/mcp-grafana:${{ steps.version.outputs.VERSION#v }}" \ | 
|  | 72 | +             '.packages[0].version = $version | | 
|  | 73 | +              .packages[0].identifier = $image | | 
|  | 74 | +              .version = $version' server.json > server.json.tmp | 
|  | 75 | +          mv server.json.tmp server.json | 
|  | 76 | +
 | 
|  | 77 | +      - name: Login to MCP Registry | 
|  | 78 | +        run: mcp-publisher login github-oidc | 
|  | 79 | + | 
|  | 80 | +      - name: Publish to MCP Registry | 
|  | 81 | +        run: mcp-publisher publish | 
0 commit comments