name: Release

on:
  push:
    tags:
      - "*"

jobs:
  release:
    name: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python 3.11
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Install release dependencies
        run: |
          python -m pip install --upgrade pip
          pip install build twine
      - name: Build and publish package
        env:
          TWINE_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
        run: |
          python -m build
          twine upload dist/*
