Skip to content

v1.2.0

v1.2.0 #7

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
skip_pypi:
description: 'Skip PyPI publish (only publish to MCP Registry)'
required: false
default: 'false'
type: boolean
version:
description: 'Version to publish (e.g., 1.2.0, required when skip_pypi is true)'
required: false
type: string
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Lint with Ruff
run: uv run ruff check mcp_documents_reader.py tests
- name: Check formatting with Ruff
run: uv run ruff format --check mcp_documents_reader.py tests
- name: Type check with Basedpyright
run: uv run basedpyright mcp_documents_reader.py
- name: Run tests with coverage
run: uv run pytest --cov-report=xml
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build package
run: uv build
- name: Check distribution
run: uvx twine check --strict dist/*
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
pypi-publish:
name: Upload release to PyPI
needs: build
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_pypi != 'true') }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mcp-documents-reader
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
mcp-registry-publish:
name: Publish to MCP Registry
needs: [build, pypi-publish]
if: always() && needs.build.result == 'success' && (needs.pypi-publish.result == 'success' || needs.pypi-publish.result == 'skipped')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Get version from tag or input
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
fi
- name: Update server.json version
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
python -c "
import json
import os
with open('server.json', 'r') as f:
data = json.load(f)
data['version'] = os.environ.get('VERSION', '')
for pkg in data.get('packages', []):
pkg['version'] = os.environ.get('VERSION', '')
with open('server.json', 'w') as f:
json.dump(data, f, indent=2)
"
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Download mcp-publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
- name: Authenticate to MCP Registry
run: ./mcp-publisher login github-oidc
- name: Publish server to MCP Registry
run: ./mcp-publisher publish