Publish Python Package to PyPI on Release #1
Workflow file for this run
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 Python Package to PyPI on Release | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| publish-to-pypi: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # 仅允许写入 GitHub 的 id-token(用于 OIDC,如需要) | |
| id-token: write | |
| # 仅允许读取 secrets.PYPI_TOKEN | |
| contents: read | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/oci-documentation-mcp-server | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Upgrade build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Install build backend | |
| run: | | |
| pip install build | |
| - name: Build distributions | |
| # 这里自动从 pyproject.toml 读取配置,生成 sdist + wheel | |
| run: | | |
| python -m build --sdist --wheel | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |