Publish Sandbox MCP #15
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: Publish Sandbox MCP | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'dev' | |
| type: choice | |
| options: | |
| - 'dev' # Development release (with date+commit) | |
| - 'formal' # Formal release (use exact version from pyproject.toml) | |
| permissions: | |
| contents: read | |
| id-token: write | |
| attestations: write # Added for attestation support | |
| jobs: | |
| publish-to-pypi: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: 'pypi-production' | |
| url: https://pypi.org/project/mcp-server-plaid | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Verify uv installation | |
| run: uv --version | |
| - name: Generate version and ensure required metadata | |
| id: generate_version | |
| working-directory: ./sandbox | |
| run: | | |
| # Get current Unix epoch time (seconds since January 1, 1970) | |
| EPOCH_TIME=$(date +%s) | |
| # Check if version is already defined in pyproject.toml | |
| if grep -q "version =" "pyproject.toml"; then | |
| # Read the current base version (remove any existing suffixes) | |
| CURRENT_VERSION=$(grep "version =" "pyproject.toml" | sed -E 's/version *= *"([^"-]+).*/\1/') | |
| echo "Base version from pyproject.toml: $CURRENT_VERSION" | |
| # Handle different release types | |
| if [ "${{ github.event.inputs.release_type }}" = "formal" ]; then | |
| # For formal release, use version exactly as in pyproject.toml | |
| FINAL_VERSION="${CURRENT_VERSION}" | |
| echo "Formal release - using exact version: $FINAL_VERSION" | |
| else | |
| # For dev release, append -dev-epochtime format | |
| FINAL_VERSION="${CURRENT_VERSION}-dev-${EPOCH_TIME}" | |
| echo "Dev release - using version with epoch timestamp: $FINAL_VERSION" | |
| fi | |
| # Update version in pyproject.toml | |
| sed -i -E "s/version *= *\"[^\"]+\"/version = \"$FINAL_VERSION\"/" pyproject.toml | |
| # Output version for later steps | |
| echo "version=$FINAL_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| # If no version defined, add initial version | |
| if [ "${{ github.event.inputs.release_type }}" = "formal" ]; then | |
| FINAL_VERSION="0.1.0" | |
| else | |
| FINAL_VERSION="0.1.0-dev-${EPOCH_TIME}" | |
| fi | |
| echo "No version found. Adding version: $FINAL_VERSION" | |
| sed -i "/build-backend/a version = \"$FINAL_VERSION\"" pyproject.toml | |
| echo "version=$FINAL_VERSION" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build package with uv | |
| working-directory: ./sandbox | |
| run: | | |
| # Build using uv build which handles both sdist and wheel | |
| uv build | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: 'sandbox/dist/*' | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: sandbox/dist/ |