name: Release
on:
  push:
    tags: ["v*"]
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v3
      with:
        path: ~/.cache/pip
        key: pip-${{ hashFiles('requirements/release.txt') }} }}
    - uses: actions/setup-python@v4
      with:
        python-version: "3.7"
    - run: pip3 install -r requirements/release.txt
    - run: pip3 install -e .
    - run: make release
    - run: twine upload dist/*
      env:
        TWINE_USERNAME: "__token__"
        TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
