From af6ec04f332059dc7789dc23c925feb80bea3d22 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Tue, 29 Mar 2022 16:12:24 +0200 Subject: [PATCH] simplify and streamline release GitHub workflow Simplify: use only one command to build both the wheel and source distribution using the build module, as recommended by packaging.python.org Streamline: only trigger the upload_test_pypi job when manually running the workflow. Before, it would also trigger on releases, but this is unnecessary. This way, the test.pypi.org channel can also be used to test an upload without having to bump the version. --- .github/workflows/release.yml | 39 +++++++---------------------------- setup.cfg | 1 + 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e21bfb47..4d02c173 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,59 +7,37 @@ on: - published jobs: - build_wheel: - name: Build universal wheel + build: + name: Build universal wheel and source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/install-python-and-package with: extras-require: publishing - - - name: Build wheel - run: python setup.py bdist_wheel - + - name: Build wheel and source distribution + run: python -m build - uses: actions/upload-artifact@v3 with: - path: dist/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: ./.github/actions/install-python-and-package - with: - extras-require: publishing - - - name: Build sdist - run: python setup.py sdist - - - uses: actions/upload-artifact@v3 - with: - path: dist/*.tar.gz - + path: dist/* upload_test_pypi: - needs: [build_wheel, build_sdist] + needs: [build] runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' steps: - uses: actions/download-artifact@v3 with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@v1.4.2 with: user: __token__ password: ${{ secrets.TEST_PYPI_TOKEN }} repository_url: https://test.pypi.org/legacy/ - upload_pypi: - needs: [build_wheel, build_sdist] + needs: [build] runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: @@ -67,7 +45,6 @@ jobs: with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@v1.4.2 with: user: __token__ diff --git a/setup.cfg b/setup.cfg index 8e7f3705..9c0c4c3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,6 +72,7 @@ dev = pandoc myst-parser publishing = + build twine wheel notebooks =