Update test.yml #15
This file contains 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: | |
push: | |
branches: | |
- main | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install UV | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
echo "$HOME/.local/bin" >> $GITHUB_PATH # Ensure UV is available | |
- name: Build Package with UV | |
run: | | |
uv build | |
- name: Upload Built Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
pypi-publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: | |
- release-build | |
permissions: | |
id-token: write # Enables OpenID Connect (No API token needed) | |
contents: read | |
environment: publish | |
steps: | |
- name: Retrieve Built Package | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish to PyPI using UV | |
uses: pypa/[email protected] | |