11name : Publish to MCP Registry 
22
33on :
4-   push :
5-     tags :
6-       - ' v*' #  Triggers on version tags like v1.0.0
4+   workflow_run :
5+     workflows : ["Build and Push Docker Image"] 
6+     types : [completed] 
7+     branches : [main] 
78
89permissions :
910  id-token : write   #  Required for OIDC authentication
1011  contents : read 
11-   packages : write   #  Required for publishing Docker images
1212
1313jobs :
1414  publish :
@@ -19,41 +19,16 @@ jobs:
1919        with :
2020          fetch-depth : 0 
2121
22-       - name : Set up Go 
23-         uses : actions/setup-go@v6 
24-         with :
25-           go-version : stable 
26-           cache : false 
27- 
28-       - name : Run tests 
29-         run : make test-unit 
30- 
31-       - name : Build binary 
32-         run : make build 
33- 
34-       - name : Set up Docker Buildx 
35-         uses : docker/setup-buildx-action@v3 
36- 
37-       - name : Log in to Docker Hub 
38-         uses : docker/login-action@v3 
39-         with :
40-           #  These secrets need to be configured in GitHub repository settings
41-           username : ${{ secrets.DOCKERHUB_USERNAME }} 
42-           password : ${{ secrets.DOCKERHUB_TOKEN }} 
43- 
4422      - name : Extract version from tag 
4523        id : version 
46-         run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT 
47- 
48-       - name : Build and push Docker image 
49-         uses : docker/build-push-action@v5 
50-         with :
51-           context : . 
52-           push : true 
53-           tags : | 
54-             grafana/mcp-grafana:${{ steps.version.outputs.VERSION }} 
55-             grafana/mcp-grafana:latest 
56- platforms : linux/amd64,linux/arm64 
24+         run : | 
25+           # Get the tag from the triggering workflow 
26+           TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "") 
27+           if [ -z "$TAG" ]; then 
28+             echo "No tag found at HEAD" 
29+             exit 1 
30+           fi 
31+           echo "VERSION=$TAG" >> $GITHUB_OUTPUT 
5732
5833name : Install dependencies 
5934        run : | 
0 commit comments