name: Publish
on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
  publish:
    runs-on: ubuntu-latest

    environment:
      name: pypi
      url: https://pypi.org/p/cssselect

    permissions:
      id-token: write

    steps:
    - uses: actions/checkout@v6

    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: 3.14

    - name: Build
      run: |
        python -m pip install --upgrade build
        python -m build

    - name: Publish to PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
