Build & Publish #8
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: Build & Publish | |
| on: | |
| release: | |
| types: [published] # runs only when a release is published | |
| workflow_dispatch: # (optional) manual trigger | |
| jobs: | |
| pypi: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| id-token: write # <<–– this is the fix | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e .[dev] # or however you install tests | |
| - name: Run tests | |
| run: pytest -q | |
| - name: Build sdist and wheel | |
| run: | | |
| python -m pip install --upgrade build | |
| python -m build --sdist --wheel --outdir dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| mcpb: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Patch manifest version | |
| run: | | |
| python -m pip install --upgrade setuptools_scm | |
| jq --arg v "$(python -m setuptools_scm)" '.version = $v' manifest.json > tmp.json && mv tmp.json manifest.json | |
| python -c "import setuptools; setuptools.setup()" egg_info | |
| cp *.egg-info/PKG-INFO . | |
| # TODO cosign or similar, pending https://github.com/modelcontextprotocol/mcpb/pull/222 | |
| - run: npx @anthropic-ai/mcpb pack | |
| - if: github.event_name == 'release' | |
| run: gh release upload ${{ github.event.release.tag_name }} fabric-rti-mcp.mcpb --clobber | |
| - if: github.event_name != 'release' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: fabric-rti-mcp.mcpb | |
| archive: false |