Skip to content

Commit

Permalink
ci: Update wheels-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
glichtner committed Oct 3, 2024
1 parent 1ace024 commit e6825c8
Showing 1 changed file with 53 additions and 10 deletions.
63 changes: 53 additions & 10 deletions .github/workflows/wheels-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ on:
tags:
- v*

workflow_dispatch:
inputs:
os_choice:
description: 'Choose the OS to build for'
required: true
default: 'all'
type: choice
options:
- all
- ubuntu-latest
- windows-latest
- macos-latest

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand All @@ -13,21 +26,41 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
# Exclude the jobs based on the workflow_dispatch input
include:
- os: macos-latest
os_choice: macos-latest
- os: windows-latest
os_choice: windows-latest
- os: ubuntu-latest
os_choice: ubuntu-latest

# Run the job only if it matches the selected OS or if "all" is selected
if: ${{ github.event_name == 'push' || github.event.inputs.os_choice == 'all' || github.event.inputs.os_choice == matrix.os_choice }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: ./wheelhouse

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
overwrite: true

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || github.event.inputs.os_choice == 'all' || github.event.inputs.os_choice == 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -36,27 +69,37 @@ jobs:

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

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
name: wheels-ubuntu-latest
path: dist/

- uses: actions/download-artifact@v4
with:
name: wheels-macos-latest
path: dist/

- uses: ncipollo/release-action@v1
- uses: actions/download-artifact@v4
with:
artifacts: "dist/*.whl,dist/*.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}
name: wheels-windows-latest
path: dist/

- uses: actions/download-artifact@v4
with:
name: sdist
path: dist/

- name: List artifacts (debug)
run: ls dist

- uses: pypa/[email protected]
with:
Expand Down

0 comments on commit e6825c8

Please sign in to comment.