deploy new iteration #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy MCP Server | |
| on: | |
| push: | |
| paths: | |
| - 'mcp-server/**' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| run: | | |
| cd mcp-server | |
| poetry install | |
| poetry run pytest | |
| - name: Build and push to Digital Ocean Registry | |
| env: | |
| DO_REGISTRY_TOKEN: ${{ secrets.DO_REGISTRY_TOKEN }} | |
| run: | | |
| cd mcp-server | |
| docker login registry.digitalocean.com -u ${{ secrets.DO_REGISTRY_TOKEN }} -p ${{ secrets.DO_REGISTRY_TOKEN }} | |
| docker build -t registry.digitalocean.com/your-registry/mcp-server:latest . | |
| docker push registry.digitalocean.com/your-registry/mcp-server:latest | |
| - name: Deploy to Droplet | |
| env: | |
| DROPLET_IP: ${{ secrets.DROPLET_IP }} | |
| SSH_KEY: ${{ secrets.SSH_KEY }} | |
| run: | | |
| echo "$SSH_KEY" > ssh_key | |
| chmod 600 ssh_key | |
| ssh -i ssh_key root@$DROPLET_IP << 'EOF' | |
| docker pull registry.digitalocean.com/your-registry/mcp-server:latest | |
| docker stop mcp-server || true | |
| docker rm mcp-server || true | |
| docker run -d --name mcp-server -p 8000:8000 \ | |
| -e LEAGUE_ID=${{ secrets.LEAGUE_ID }} \ | |
| -e CACHE_TTL_SECONDS=300 \ | |
| -e API_KEY=${{ secrets.API_KEY }} \ | |
| registry.digitalocean.com/your-registry/mcp-server:latest | |
| EOF |