Add MCP server release workflow (#1025)
* conductor-checkpoint-start * conductor-checkpoint-msg_01B1n4yHQFoVrWWdKcqPQ4Qa * conductor-checkpoint-msg_01LS1v8ok5qtzAofv1TFRDHt * conductor-checkpoint-msg_01H5pxrRKDpizF4wv1irnvRz * conductor-checkpoint-msg_01EFo2gQBKSFkGcJoJ4bUWNS * conductor-checkpoint-msg_01QW92pnqMv17sfV4CxFKn7Y * conductor-checkpoint-msg_01VqPRMaBRGpBf9E8sdpPeFa * Fix critical issues in MCP server release workflow - 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> * Remove workflow_dispatch trigger from MCP server release Simplify workflow to only trigger on mcp-v*.*.* tags. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * conductor-checkpoint-msg_019AX8ymwf9eec2KF979CJCM * conductor-checkpoint-msg_01LMofTLUNkicSq5vpFmsd1C * Add semantic version validation to MCP server release Validate tag follows X.Y.Z format before processing. Rejects malformed tags like mcp-v1.0 or mcp-v1.0.0.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * conductor-checkpoint-msg_01Ndj59qcprSNRfe3vuciwwA * conductor-checkpoint-msg_01PmA8bfCLKv7yHiaBz2MypS --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
71f1f66d11
commit
56f6d09df0
2 changed files with 74 additions and 73 deletions
73
.github/workflows/mcp-server-docker.yml
vendored
73
.github/workflows/mcp-server-docker.yml
vendored
|
|
@ -1,73 +0,0 @@
|
|||
name: Build and Push MCP Server Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "mcp_server/pyproject.toml"
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths:
|
||||
- "mcp_server/pyproject.toml"
|
||||
branches:
|
||||
- main
|
||||
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:
|
||||
build-and-push:
|
||||
runs-on: depot-ubuntu-24.04-small
|
||||
environment: development
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract version from pyproject.toml
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(python -c "import tomllib; print(tomllib.load(open('mcp_server/pyproject.toml', 'rb'))['project']['version'])")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
|
||||
- name: Log in to Docker Hub
|
||||
if: github.event_name != 'pull_request' && (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=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=raw,value=${{ steps.version.outputs.tag }}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Depot build and push image
|
||||
uses: depot/build-push-action@v1
|
||||
with:
|
||||
project: v9jv1mlpwc
|
||||
context: ./mcp_server
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || inputs.push_image) }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
74
.github/workflows/release-mcp-server.yml
vendored
Normal file
74
.github/workflows/release-mcp-server.yml
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
name: Release MCP Server
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["mcp-v*.*.*"]
|
||||
|
||||
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}
|
||||
|
||||
if ! [[ $TAG_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Tag must follow semantic versioning: mcp-vX.Y.Z"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
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: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
Loading…
Add table
Reference in a new issue