- Fix Docker tag format: use version only (0.4.0) instead of mcp-v0.4.0 - Add Python 3.11 setup for tomllib compatibility - Add workflow_dispatch trigger for testing without creating tags - Add conditional push logic for manual testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
name: Release MCP Server
|
|
|
|
on:
|
|
push:
|
|
tags: ["mcp-v*.*.*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
push_image:
|
|
description: "Push image to registry (unchecked for testing)"
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
env:
|
|
REGISTRY: docker.io
|
|
IMAGE_NAME: zepai/knowledge-graph-mcp
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: depot-ubuntu-24.04-small
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
environment:
|
|
name: release
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Extract and validate version
|
|
id: version
|
|
run: |
|
|
TAG_VERSION=${GITHUB_REF#refs/tags/mcp-v}
|
|
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('mcp_server/pyproject.toml', 'rb'))['project']['version'])")
|
|
|
|
if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
|
|
echo "Tag version mcp-v$TAG_VERSION does not match mcp_server/pyproject.toml version $PROJECT_VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
echo "version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Log in to Docker Hub
|
|
if: github.event_name != 'workflow_dispatch' || inputs.push_image
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up Depot CLI
|
|
uses: depot/setup-action@v1
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=${{ steps.version.outputs.version }}
|
|
type=raw,value=latest
|
|
|
|
- name: Build and push Docker image
|
|
uses: depot/build-push-action@v1
|
|
with:
|
|
project: v9jv1mlpwc
|
|
context: ./mcp_server
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name != 'workflow_dispatch' || inputs.push_image }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|