haiku.rag/.github/workflows/publish-mcp.yml
2025-10-16 13:02:12 +03:00

38 lines
1.5 KiB
YAML

name: Publish to MCP Registry
on:
workflow_dispatch:
workflow_run:
workflows: ["Build & publish to pypi"]
types:
- completed
jobs:
publish-mcp:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Generate server.json from template
run: |
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
sed "s/{{VERSION}}/$VERSION/g" server.json > server.json.tmp
mv server.json.tmp server.json
echo "Generated server.json with version: $VERSION"
- name: Install MCP Publisher
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/modelcontextprotocol/registry/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
curl -L https://github.com/modelcontextprotocol/registry/releases/download/${LATEST_RELEASE}/mcp-publisher_linux_amd64.tar.gz -o mcp-publisher.tar.gz
tar -xzf mcp-publisher.tar.gz
chmod +x mcp-publisher
sudo mv mcp-publisher /usr/local/bin/
- name: Login to MCP Registry
run: mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: mcp-publisher publish