Add MCP server for Claude Code integration #6
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: Release Python SDK | |
| on: | |
| push: | |
| paths: | |
| - 'sdk/python/**' | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| working-directory: ./sdk/python | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Lint | |
| working-directory: ./sdk/python | |
| run: ruff check src tests | |
| - name: Type check | |
| working-directory: ./sdk/python | |
| run: mypy src | |
| - name: Run tests | |
| working-directory: ./sdk/python | |
| run: pytest | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| permissions: | |
| id-token: write # Required for PyPI trusted publishing | |
| contents: write # Required for creating GitHub releases | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if version changed | |
| id: version-check | |
| working-directory: ./sdk/python | |
| run: | | |
| # Get current version from pyproject.toml | |
| CURRENT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| # Get previous version (if exists) | |
| git show HEAD~1:sdk/python/pyproject.toml > /tmp/prev-pyproject.toml 2>/dev/null || echo '[project]\nversion = "0.0.0"' > /tmp/prev-pyproject.toml | |
| PREV_VERSION=$(python -c "import tomllib; print(tomllib.load(open('/tmp/prev-pyproject.toml', 'rb')).get('project', {}).get('version', '0.0.0'))" 2>/dev/null || echo "0.0.0") | |
| echo "prev_version=$PREV_VERSION" >> $GITHUB_OUTPUT | |
| # Check if versions differ | |
| if [ "$CURRENT_VERSION" != "$PREV_VERSION" ]; then | |
| echo "Version changed from $PREV_VERSION to $CURRENT_VERSION" | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version unchanged ($CURRENT_VERSION)" | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up Python | |
| if: steps.version-check.outputs.changed == 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build tools | |
| if: steps.version-check.outputs.changed == 'true' | |
| run: pip install build | |
| - name: Build package | |
| if: steps.version-check.outputs.changed == 'true' | |
| working-directory: ./sdk/python | |
| run: python -m build | |
| - name: Publish to PyPI | |
| if: steps.version-check.outputs.changed == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: sdk/python/dist/ | |
| - name: Create GitHub Release | |
| if: steps.version-check.outputs.changed == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: python-sdk-v${{ steps.version-check.outputs.current_version }} | |
| name: Python SDK v${{ steps.version-check.outputs.current_version }} | |
| body: | | |
| ## nfc-agent (Python) v${{ steps.version-check.outputs.current_version }} | |
| Install via pip: | |
| ```bash | |
| pip install nfc-agent==${{ steps.version-check.outputs.current_version }} | |
| ``` | |
| generate_release_notes: true |