Add workflow to build and push to PyPI

This commit is contained in:
Simon Conseil
2020-10-11 18:06:04 -03:00
parent 0779880198
commit e213709cae

35
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install pep517 and twine
run: python -m pip install pep517 twine
- name: Build package
run: python -m pep517.build --source --binary .
- name: List result
run: ls -l dist
- name: Check long_description
run: python -m twine check dist/*
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}