| 1 |
name: build |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
pull_request: |
| 7 |
branches: |
| 8 |
|
| 9 |
permissions: |
| 10 |
contents: read |
| 11 |
|
| 12 |
jobs: |
| 13 |
test: |
| 14 |
runs-on: ${{ matrix.os }} |
| 15 |
strategy: |
| 16 |
matrix: |
| 17 |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] |
| 18 |
python-version: ["pypy3.11", "3.9", "3.10", "3.11", "3.12", "3.13"] |
| 19 |
env: |
| 20 |
UV_PYTHON: ${{ matrix.python-version }} |
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v4 |
| 23 |
- name: Install uv |
| 24 |
uses: astral-sh/setup-uv@v6 |
| 25 |
- name: Install package and development dependencies |
| 26 |
run: uv sync --all-extras --dev |
| 27 |
- name: Test with pytest |
| 28 |
run: | |
| 29 |
uv run pytest |
| 30 |
|
| 31 |
deploy: |
| 32 |
name: Deploy |
| 33 |
environment: Deployment |
| 34 |
needs: test |
| 35 |
runs-on: ubuntu-latest |
| 36 |
if: github.ref=='refs/heads/main' && github.event_name!='pull_request' |
| 37 |
|
| 38 |
permissions: |
| 39 |
contents: write |
| 40 |
id-token: write |
| 41 |
|
| 42 |
steps: |
| 43 |
- uses: actions/checkout@v4 |
| 44 |
|
| 45 |
- name: Set up Python |
| 46 |
uses: actions/setup-python@v5 |
| 47 |
with: |
| 48 |
python-version: "3.10" |
| 49 |
|
| 50 |
- name: Check release |
| 51 |
id: check_release |
| 52 |
run: | |
| 53 |
python -m pip install autopub[github] |
| 54 |
autopub check |
| 55 |
|
| 56 |
- name: Publish |
| 57 |
if: ${{ steps.check_release.outputs.autopub_release=='true' }} |
| 58 |
env: |
| 59 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 |
run: | |
| 61 |
autopub prepare |
| 62 |
autopub commit |
| 63 |
autopub build |
| 64 |
autopub githubrelease |
| 65 |
|
| 66 |
- name: Upload package to PyPI |
| 67 |
if: ${{ steps.check_release.outputs.autopub_release=='true' }} |
| 68 |
uses: pypa/gh-action-pypi-publish@release/v1 |