diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a37dd4..6fd172b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,14 +2,15 @@ name: Check test and code linting on: [push] jobs: - pre-commit: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: pre-commit/action@v3.0.0 - build: + test: runs-on: ubuntu-20.04 + needs: lint strategy: matrix: include: @@ -31,3 +32,26 @@ jobs: pip install tox codecov - name: Run tests run: tox -e ${{ matrix.tox || 'py' }} + + publish: + needs: test + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@master + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*