From c1b88717c77e8c7b3461fb9045c070d0289bb769 Mon Sep 17 00:00:00 2001 From: Jan Janak Date: Tue, 28 Jun 2022 18:19:44 -0400 Subject: [PATCH] Add PyPI upload to the release script --- tools/release.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/release.sh b/tools/release.sh index 586848c..f9d4aac 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -14,10 +14,23 @@ fi version="$1" +if [ -z "$(pip show build)" ] ; then + bail "Error: Please install the Python build package first" +fi + +if [ -z "$(pip show twine)" ] ; then + bail "Error: Please install the Python twine package first" +fi + if [ -z "$GITHUB_TOKEN" ] ; then bail "Error: GITHUB_TOKEN environment variable is not set" fi +# The token can be usually found in ~/.pypirc +if [ -z "$PYPI_TOKEN" ] ; then + bail "Error: PYPI_TOKEN environment variable is not set" +fi + make clean # We only generate releases from a git repository clone that does not have any @@ -75,3 +88,8 @@ $sums **Full changelog**: https://github.com/hardwario/$basename/compare/$previous_tag...$new_tag EOF + +# Build the Python library +make python + +python -m twine upload -u __token__ -p "$PYPI_TOKEN" python/dist/*