name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  publish:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v5
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install build and twine
        run: |
          python -m pip install --upgrade pip
          pip install build twine
      - name: Build sdist
        run: |
          python -m build --sdist
      - name: Publish to PyPI
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_PYBFOAM_API_TOKEN }}
        run: |
          twine upload dist/*
