Update and rename wheels.yml to build_wheels.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload to PyPI | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
build_wheels: | ||
name: Build wheels on manylinux2014 | ||
runs-on: ubuntu-latest # You still need an Ubuntu base for Docker | ||
services: | ||
docker: | ||
image: docker://quay.io/pypa/manylinux2014_x86_64 | ||
options: --user root | ||
container: | ||
image: quay.io/pypa/manylinux2014_x86_64 # Ensuring the Manylinux2014 image is active | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9, 3.10] # Designate the Python versions your app supports | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Build manylinux2014 wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: cp3?-manylinux_x86_64 # Explicitly stating that this job would be building only for target: CPython 3.x on manylinux2014 | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.python-version }}-${{ github.run_number }} | ||
path: ./wheelhouse/*.whl | ||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build sdist | ||
run: pipx run build --sdist | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks all CIBW artifacts into dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
# To test: repository-url: https://test.pypi.org/legacy/ |