Skip to content

[pre-commit.ci] pre-commit autoupdate #120

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #120

name: Build, test, and deploy
on:
push:
tags:
- "**"
pull_request:
jobs:
build:
name: Build source and wheel distribution
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Build source package
run: |
pip install build
python -m build .
- name: Upload source package
uses: actions/upload-artifact@v3
with:
name: distribution
path: dist/
test:
name: Test source and wheel distributions
runs-on: ubuntu-20.04
needs: [build]
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: distribution
path: dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test sdist with tox
run: tox --installpkg dist/*.tar.gz
- name: Test wheel with tox
run: tox --installpkg dist/*.whl
deploy:
runs-on: ubuntu-latest
needs: [test]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: distribution
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}