Skip to content

Workflow file for this run

name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
on:
push:
pull_request:
release:
types: [published]
jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install tox
run: >-
pip install tox
- name: Pre Commit
run: >-
tox -e pre-commit
- name: Test
run: >-
tox
- name: Build
run: >-
tox -e build
- name: Publish distribution πŸ“¦ to Test PyPI
if: contains(github.ref, 'refs/heads/master')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
run: >-
tox -e publish
- name: Publish distribution πŸ“¦ to PyPI
if: contains(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
run: >-
tox -e publish -- --repository pypi