name: Check Build

on:
    push:
        branches: [main]
    pull_request:
        types:
            - opened
            - synchronize

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

jobs:
    package:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3

            - name: Set up Python
              uses: actions/setup-python@v5
              with:
                  python-version: "3.13"

            - 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
