diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 00000000..db6cd4a3 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,32 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Deploy to PyPI + +on: + release: + types: [published] + +jobs: + release-pypi: + environment: release-pypi + # Upload to PyPI on every published release + if: github.event.action == 'published' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Build package + run: | + python -m pip install --upgrade pip + pip install setuptools build wheel twine + python -m build + twine check --strict dist/* + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: True + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/tags-to-pypi.yml b/.github/workflows/tags-to-pypi.yml deleted file mode 100644 index fc1b8611..00000000 --- a/.github/workflows/tags-to-pypi.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: PyPi Publisher - -on: - push: - tags: - - 'v*' - -jobs: - build-n-publish: - name: Build and publish Python package to PyPi - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Build tarballs - run: | - pip install wheel - python setup.py bdist_wheel - python setup.py sdist --formats=gztar - - name: Publish artifacts to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_PASSWORD }} - repository_url: https://upload.pypi.org/legacy/