Files
uniface/.github/workflows/build.yml
2025-08-30 22:50:28 +09:00

65 lines
1.5 KiB
YAML

name: Build, Test, and Publish
on:
push:
branches:
- main # Trigger on pushes to main
tags:
- "v*.*.*" # Trigger publish on version tags
pull_request:
branches:
- main # Trigger checks on pull requests to main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Run Tests
run: pytest
publish:
runs-on: ubuntu-latest
needs: build # Publish only if tests pass
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Trigger only on pushes to main
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10" # Use a single Python version for publishing
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build Package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*