name: Build

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python 3.9
        uses: actions/setup-python@v5
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: "**/pyproject.toml"
      - name: Install build dependencies
        run: python -m pip install --upgrade pip wheel twine build
      - name: Build package
        run: python -m build
      - name: Check package
        run: twine check --strict dist/*.whl
