diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml new file mode 100644 index 00000000..5377be92 --- /dev/null +++ b/.github/workflows/dist.yml @@ -0,0 +1,26 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + build-n-publish: + name: Build and Publish Package + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@master + - name: Set up Python 3.8 + uses: actions/setup-python@master + with: + python-version: 3.8 + - name: Upgrade setuptools and wheel + run: python -m pip install --user --upgrade setuptools wheel + - name: Build a binary wheel and a source tarball + run: python setup.py sdist bdist_wheel + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.pypi_password }} + # The PyPI API token (password) was generated as per https://pypi.org/help/#apitoken + # The token is stored in this GH repo under `Settings > Secrets > pypi_password` diff --git a/release-requirements.txt b/release-requirements.txt deleted file mode 100644 index c9133d67..00000000 --- a/release-requirements.txt +++ /dev/null @@ -1 +0,0 @@ -twine \ No newline at end of file diff --git a/release.sh b/release.sh index 1b7388c0..beedfc9d 100644 --- a/release.sh +++ b/release.sh @@ -21,8 +21,8 @@ git tag $TAG_NAME git push git push origin $TAG_NAME -# Install release requirements for pypi push -pip3 install twine - -# Push to pypi -rm -rf dist; python3 setup.py sdist bdist_wheel; python3 -m twine upload dist/* +# The `.github/workflows/dist.yml` Workflow is triggered automatically +# when the repo is tagged by running this Shell script +# or manually creating a relase in GH. +# In either case, the Workflow will build the Python package +# in GH's CI infrastructure and publish it to PyPI.