From d26451061869e1914374d4f71894c482eb72bc72 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Fri, 9 Jun 2023 19:21:52 +0100 Subject: [PATCH] build sdist and pure wheel in the same wheels.yml workflow .zip is deprecated for Python source distributions so use the default .tar.gz --- .github/workflows/publish.yml | 34 ---------------------------------- .github/workflows/wheels.yml | 35 +++++++++++++++++++++++++++-------- setup.cfg | 3 --- 3 files changed, 27 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index ea5ebc9f5..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This workflows will upload a Python Package using Twine when a tag 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: Upload Python Package - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - '*.*.*' # e.g. 1.0.0 or 20.15.10 - -permissions: - contents: read - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dependencies - run: | - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 654686a2a..479584bac 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -3,9 +3,6 @@ name: Build + Deploy on: push: tags: ["*.*.*"] - release: - types: - - published # enables workflow to be run manually # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch workflow_dispatch: @@ -21,6 +18,26 @@ env: jobs: + build_pure: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + pip install setuptools wheel twine + - name: Build source distribution and pure-python wheel + run: | + python setup.py sdist bdist_wheel + - uses: actions/upload-artifact@v3 + with: + path: | + dist/*.whl + dist/*.tar.gz + build_wheels: name: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -86,17 +103,19 @@ jobs: path: wheelhouse/*.whl deploy: - name: Upload if release - needs: [build_wheels, build_arch_wheels] + name: Upload to PyPI on tagged commit runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' - + needs: + - build_pure + - build_wheels + - build_arch_wheels + # only run if the commit is tagged... + if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/download-artifact@v3 with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@v1.8.6 with: user: __token__ diff --git a/setup.cfg b/setup.cfg index d85a56b40..63f4b7ea1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,9 +24,6 @@ replace = __version__ = "{new_version}" search = version="{current_version}" replace = version="{new_version}" -[sdist] -formats = zip - [metadata] license_files = LICENSE