ci: enable publish-pypi after TestPyPI verification (v1.1.0-test1 OK) #2
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-pypi | |
| # Publishes a tagged build to **PyPI** via OIDC Trusted Publishing. | |
| # | |
| # Triggered by tags matching v* (semver, no -test / -rc suffix). | |
| # | |
| # Status: ENABLED — TestPyPI verification was green for v1.1.0-test1. | |
| # | |
| # Requires (one-time, Web UI): | |
| # PyPI → Account Settings → Publishing → Add a pending publisher | |
| # Owner / Repo: ChatChatTech / anet-python-sdk | |
| # Workflow file: publish-pypi.yml | |
| # Environment: pypi | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build sdist + wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine pytest httpx | |
| - name: Run offline unit tests | |
| run: pytest -q tests/test_svc.py | |
| - name: Build distributions | |
| run: python -m build | |
| - name: Twine check | |
| run: python -m twine check dist/* | |
| - name: Upload dist artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish-pypi: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/agentnetwork/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download dist artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |