Skip to content

Update the workflow to update both root and package version #4

Update the workflow to update both root and package version

Update the workflow to update both root and package version #4

name: Build and Publish MCP Server
on:
push:
tags: ['v*']
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: dockersamples/mcp-docker-release-information:${{ steps.version.outputs.version }}
labels: |
io.modelcontextprotocol.server.name=io.github.dockersamples/mcp-docker-release-information
- name: Update server.json version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
jq --arg version "$VERSION" '.version = $version | .packages[0].version = $version' server.json > tmp.json
mv tmp.json server.json
- name: Install MCP Publisher
run: |
cd /tmp
curl -Lo mcp-publisher.tar.gz https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_linux_amd64.tar.gz
tar -xzf mcp-publisher.tar.gz
chmod +x mcp-publisher
mv mcp-publisher /usr/local/bin/mcp-publisher
- name: Publish to MCP Registry
run: |
mcp-publisher login github-oidc
mcp-publisher publish