Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify building & uploading packages in CI #3

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 11 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,31 @@ jobs:
run: |
python3 -m pytest -v

build_wheels:
name: Build wheels
packages:
name: Build packages
needs: tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp{38,39,310,311,312}-manylinux_x86_64

- uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
output-dir: dist

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

upload_pypi:
needs: [ build_wheels, build_sdist ]
runs-on: ubuntu-latest
# upload to PyPI on any tag on main
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
# unpack all artifacts into dist/
path: dist
merge-multiple: true
- name: List package files
run: |
ls -lh dist

# upload to PyPI on any tag on main
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.pypi_token }}