Update publish workflow to create wheels (#567)

This commit is contained in:
J. Nick Koston 2023-10-12 08:56:11 -10:00 committed by GitHub
parent 4a6dcaf0da
commit b491d7b840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 16 deletions

View File

@ -8,23 +8,49 @@ permissions:
contents: read contents: read
jobs: jobs:
deploy-pypi: build_wheels:
name: Build and publish to PyPi name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4 - name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with: with:
python-version: '3.x' path: dist/*.tar.gz
- name: Set up python environment
run: | upload_pypi:
pip3 install -e . needs: [build_wheels, build_sdist]
pip3 install setuptools wheel twine runs-on: ubuntu-latest
- name: Build environment: pypi
run: python setup.py sdist bdist_wheel permissions:
- name: Upload id-token: write
env: if: github.event_name == 'release' && github.event.action == 'published'
TWINE_USERNAME: __token__ steps:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - uses: actions/download-artifact@v3
run: twine upload dist/* with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}