Publish Python Package #2
Workflow file for this run
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
# adapted from: | |
# https://til.simonwillison.net/pypi/pypi-releases-from-github | |
# https://github.com/snok/install-poetry | |
# https://jacobian.org/til/github-actions-poetry/ | |
# https://github.com/orgs/community/discussions/25305#discussioncomment-8256560 | |
name: Publish Python Package | |
on: | |
release: | |
types: [created] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install test dependencies | |
run: | | |
uv sync --group test | |
- name: Test with python ${{ matrix.python-version }} | |
run: uv run --frozen pytest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [test] | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
python-version: ${{ matrix.python-version }} | |
- name: Build | |
run: | | |
uv build | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |