Skip to content

feat: automate release workflow based on version file changes #7

feat: automate release workflow based on version file changes

feat: automate release workflow based on version file changes #7

Workflow file for this run

name: Publish to MCP Registry
on:
push:
branches:
- main
paths:
- 'server.json'
- '.github/workflows/publish-mcp.yml'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write # Need write permission to create tags
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history for tags
- name: Validate server.json
run: |
if [ ! -f "server.json" ]; then
echo "Error: server.json not found"
exit 1
fi
echo "server.json found and ready for publishing"
- name: Get version from server.json
id: get_version
run: |
VERSION=$(jq -r '.version' server.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version from server.json: $VERSION"
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.get_version.outputs.version }} already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.get_version.outputs.version }} does not exist"
fi
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release v${{ steps.get_version.outputs.version }}"
git push origin "v${{ steps.get_version.outputs.version }}"
- name: Install MCP Publisher
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 (DNS Auth)
run: ./mcp-publisher login dns --domain pfx.ch --private-key ${{ secrets.MCP_PRIVATE_KEY }}
- name: Publish to MCP Registry
run: ./mcp-publisher publish