name: Deploy to pypi

on:
    release:
        types: [created]

jobs:
    publish:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout sources
              uses: actions/checkout@v5

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

            - name: Install dependencies
              run: |
                  pip install . && pip install hatch
            - name: Publish einops to PyPi
              env:
                  HATCH_INDEX_USER: "__token__"
                  HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
              run: |
                  hatch run pypi:deploy
