auto upload to pypi on release

This commit is contained in:
Eren Gölge
2021-06-04 12:20:06 +02:00
parent e66753bd0d
commit ba9bcf7c6b
5 changed files with 90 additions and 49 deletions
+38
View File
@@ -0,0 +1,38 @@
name: Publish Python 🐍 distributions 📦 to PyPI
on:
release:
types: [published]
defaults:
run:
shell:
bash
jobs:
build-package:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Verify tag matches version
run: |
set -ex
version=$(cat TTS/VERSION)
tag="${GITHUB_REF/refs\/tags\/}"
if [[ "v$version" != "$tag" ]]; then
exit 1
fi
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: |
python -m pip install -U pip setuptools twine toml
python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip install -r /dev/stdin
- run: |
python setup.py sdist
- name: Setup PyPI config
run: |
cat << EOF > ~/.pypirc
[pypi]
username=__token__
password=${{ secrets.PYPI_TOKEN }}
EOF
- run: |
twine upload --repository pypi dist/*.tar.gz