Skip to content

chore: bump version to 1.0.6 and fix README naming #36

chore: bump version to 1.0.6 and fix README naming

chore: bump version to 1.0.6 and fix README naming #36

Workflow file for this run

# Development MCP Server Deployment
#
# Deploys the remote MCP server to mcp-dev.digitalsamba.com
# Triggers automatically on push to develop branch
#
# GitHub Secrets Required:
# Repository secrets:
# - DOCKER_REGISTRY: Registry hostname
# - REGISTRY_USERNAME: Docker registry username
# - REGISTRY_PASSWORD: Docker registry password
# - DEPLOYMENT_USER: SSH user for deployment
# - DEPLOYMENT_SSH_KEY: SSH private key
#
# Environment secrets (development):
# - DEPLOYMENT_SERVER: Target server hostname
# - DEPLOYMENT_PATH: Server path for deployment files
# - MCP_URL: Public URL for health checks
name: Deploy Dev MCP Server
on:
push:
branches:
- develop
workflow_dispatch:
env:
IMAGE_NAME: digitalsamba-mcp-server
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test:ci
continue-on-error: true
build-and-deploy:
name: Build and Deploy to Dev
needs: test
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Calculate commits ahead of latest tag
id: commits
run: |
# Get the latest tag by date (works even if tag is on different branch)
LATEST_TAG=$(git tag --sort=-creatordate | head -1)
if [ -n "$LATEST_TAG" ]; then
# Find merge base between tag and HEAD, then count commits since
MERGE_BASE=$(git merge-base $LATEST_TAG HEAD 2>/dev/null || echo "")
if [ -n "$MERGE_BASE" ]; then
COMMITS_AHEAD=$(git rev-list ${MERGE_BASE}..HEAD --count)
else
COMMITS_AHEAD=0
fi
else
COMMITS_AHEAD=0
fi
echo "ahead=$COMMITS_AHEAD" >> $GITHUB_OUTPUT
echo "Latest tag: $LATEST_TAG, Merge base: $MERGE_BASE, Commits ahead: $COMMITS_AHEAD"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
build-args: |
GIT_COMMIT=${{ github.sha }}
GIT_REF=${{ github.ref_name }}
BUILD_TIME=${{ github.event.head_commit.timestamp }}
COMMITS_AHEAD=${{ steps.commits.outputs.ahead }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Copy deployment files to server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.DEPLOYMENT_SERVER }}
username: ${{ secrets.DEPLOYMENT_USER }}
key: ${{ secrets.DEPLOYMENT_SSH_KEY }}
source: "deployment/docker-compose.yml"
target: ${{ secrets.DEPLOYMENT_PATH }}
strip_components: 1
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3
env:
REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
with:
host: ${{ secrets.DEPLOYMENT_SERVER }}
username: ${{ secrets.DEPLOYMENT_USER }}
key: ${{ secrets.DEPLOYMENT_SSH_KEY }}
envs: REGISTRY,IMAGE_NAME
script: |
cd ${{ secrets.DEPLOYMENT_PATH }}
# Login to registry
echo "${{ secrets.REGISTRY_PASSWORD }}" | sudo docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
# Pull latest image
sudo docker pull ${REGISTRY}/${IMAGE_NAME}:latest
# Stop and remove old container
sudo docker compose down --remove-orphans || true
# Start new container
sudo docker compose up -d
# Wait for service to be healthy
echo "Waiting for service to be healthy..."
sleep 10
# Cleanup old images
sudo docker image prune -f
- name: Verify deployment
run: |
echo "Waiting for service startup..."
sleep 15
# Health check
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" ${{ secrets.MCP_URL }}/health || echo "000")
if [ "$HTTP_STATUS" = "200" ]; then
echo "✅ Health check passed (HTTP $HTTP_STATUS)"
else
echo "⚠️ Health check returned HTTP $HTTP_STATUS"
curl -v ${{ secrets.MCP_URL }}/health || true
fi
- name: Deployment summary
run: |
echo "## 🚀 Dev MCP Server Deployed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| **Environment** | development |" >> $GITHUB_STEP_SUMMARY
echo "| **URL** | ${{ secrets.MCP_URL }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Commit** | ${{ github.sha }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Branch** | ${{ github.ref_name }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Triggered by** | ${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY