Skip to content

Commit

Permalink
Update and rename wheels.yml to build_wheels.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderchang1 authored Feb 20, 2024
1 parent 6f45817 commit 18a1400
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 33 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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/
33 changes: 0 additions & 33 deletions .github/workflows/wheels.yml

This file was deleted.

0 comments on commit 18a1400

Please sign in to comment.