Local wheels in env (#116) #4
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 | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| tags: | |
| - "v*" # Trigger on tags like v0.1.0 (PyPI) | |
| - "test-v*" # Trigger ont ags like test-v0.1.0 (Test-PyPI) | |
| jobs: | |
| publish: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write # Required for PyPI Trusted Publishing | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up python | |
| id: setup-python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Set up uv | |
| run: curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh | |
| - name: Check package metadata | |
| run: uv version | |
| - name: Build the package | |
| run: uv build | |
| - name: Sanity check that package installs and imports | |
| run: | | |
| echo "Verifying package installs and imports correctly..." | |
| uv venv .venv | |
| uv pip install dist/*.whl | |
| uv run python -c "import tgm; print(tgm.__version__)" | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: >- | |
| ${{ startsWith(github.ref_name, 'test-v') && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }} |