name: ๐ Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
test:
name: ๐งช Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: โก Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: ๐ฆ Install dependencies
run: |
uv venv
uv pip install -e .
- name: ๐ Test core module imports
run: |
uv run python -c "from calculator_mcp.server import cli_main; print('โ
Core module imports work')"
uv run python -c "import calculator_mcp; print('โ
Package imports work')"
- name: ๐๏ธ Test package build
run: |
uv build --wheel
build-and-release:
name: ๐๏ธ Build and Release
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
## ๐ Calculator MCP Server ${{ github.ref_name }}
### โจ ๆฐ็นๆง
่ฏทๆฅ็ [GitHub Commits](https://github.com/tengmmvp/Calculator_MCP/commits) ไบ่งฃ่ฏฆ็ปๅๆดใ
### ๐ ๏ธ ๅฎ่ฃ
ๆนๅผ
#### ไฝฟ็จ uvx๏ผๆจ่๏ผ
```bash
uvx git+https://github.com/tengmmvp/Calculator_MCP@${{ github.ref_name }}
```
#### Claude Desktop ้
็ฝฎ
```json
{
"mcpServers": {
"calculator": {
"command": "uvx",
"args": ["git+https://github.com/tengmmvp/Calculator_MCP@${{ github.ref_name }}"],
"description": "Mathematical calculator with tools, resources, and prompts"
}
}
}
```
### ๐ ๆๆกฃ
- ๐ [ๅฎๆดๆๆกฃ](https://github.com/tengmmvp/Calculator_MCP#readme)
- ๐ง [API ๅ่](https://github.com/tengmmvp/Calculator_MCP/blob/main/docs/API.md)
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
files: |
dist/*
LICENSE
README.md
docker-release:
name: ๐ณ Docker Release
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ณ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: ๐ Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: ๐ Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: ๐๏ธ Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ github.ref_name }}
BUILD_DATE=${{ github.event.head_commit.timestamp }}
VCS_REF=${{ github.sha }}