Refactor GitHub Actions workflow for building wheels

This commit is contained in:
BillTheMaker
2025-12-06 19:52:07 -07:00
committed by GitHub
parent 4fb0b78a5f
commit e5f1dcf7b9

View File

@@ -7,18 +7,13 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build_wheels: build_and_publish:
name: Build wheels on ${{ matrix.os }} name: Build and Publish All Wheels
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
include: os: [ubuntu-latest, macos-latest, windows-latest]
- os: ubuntu-latest target: [x86_64]
target: x86_64
- os: macos-latest
target: x86_64
- os: windows-latest
target: x86_64
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -33,26 +28,26 @@ jobs:
with: with:
toolchain: stable toolchain: stable
- name: Build wheels with Maturin - name: Build wheel
uses: PyO3/maturin-action@v1 uses: PyO3/maturin-action@v1
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
command: build command: build
args: --release --out dist --find-interpreter args: --release --out dist --find-interpreter
- name: Upload built wheels as Artifact - name: Upload wheel artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: wheels-${{ matrix.os }}-${{ matrix.target }} name: wheel-${{ matrix.os }}-${{ matrix.target }}
path: dist path: dist/*.whl
publish: publish:
name: Publish to PyPI name: Publish All Wheels
needs: [build_and_publish]
runs-on: ubuntu-latest runs-on: ubuntu-latest
# NO NEEDS, NO IF - INDEPENDENT
steps: steps:
- name: Install maturin for upload - name: Install maturin
run: pip install maturin run: pip install maturin
- name: Download ALL wheels - name: Download ALL wheels
@@ -60,16 +55,12 @@ jobs:
with: with:
path: dist path: dist
- name: Flatten wheels to dist/ - name: Flatten and upload
run: |
find dist -name "*.whl" -exec cp {} dist/ \;
echo "Wheels ready:"
ls -la dist/*.whl
- name: Publish to PyPI
env: env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: | run: |
cd dist mkdir -p dist/flattened
find dist -name "*.whl" -exec cp {} dist/flattened/ \;
cd dist/flattened
ls -la *.whl ls -la *.whl
maturin upload --skip-existing --non-interactive maturin upload --skip-existing --non-interactive