Skip to content

Commit

Permalink
Modernize the PyPI release workflow (#1716)
Browse files Browse the repository at this point in the history
This PR brings the wheel-build-and-PyPI-upload workflow in line with modern standards.

* Future proofing: use latest versions of Python and the various actions, so that with luck we don't need to update this workflow again for a while.
* Use python -m build --sdist instead of python setup.py sdist to build packages
* Remove unnecessary package installs.
  • Loading branch information
mdickinson committed Aug 18, 2022
1 parent f73f528 commit aca38d0
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/release-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@ jobs:
steps:

- name: Check out the release commit
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
if: runner.os == 'Linux'

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install Python packages needed for wheel build and upload
run: |
python -m pip install --upgrade pip setuptools
python -m pip install twine wheel
run: python -m pip install twine

- name: Build wheels
uses: pypa/cibuildwheel@v2.9.0
Expand All @@ -55,26 +53,23 @@ jobs:
steps:

- name: Check out the release commit
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install Python packages needed for sdist build and upload
run: |
python -m pip install --upgrade pip setuptools
python -m pip install twine
run: python -m pip install build twine

- name: Build sdist
run: |
python setup.py sdist
run: python -m build --sdist

- name: Publish sdist to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m twine check --strict dist/*.tar.gz
python -m twine upload dist/*.tar.gz
python -m twine check --strict dist/*
python -m twine upload dist/*

0 comments on commit aca38d0

Please sign in to comment.