Skip to content

Automatically push to pypi #68

Automatically push to pypi

Automatically push to pypi #68

Workflow file for this run

# Taken from osqp-python
name: Build Wheels
on:
# Triggers the workflow on push or pull request events
push:
branches:
- "*"
- "*/*"
- "**"
pull_request:
branches: [main]
# Manual trigger for pushing to PyPI
workflow_dispatch:
inputs:
deploy:
description: "Upload wheels & sdist to PyPI?"
required: true
type: boolean
default: false
jobs:
build_sdist:
name: Build source
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@master
with:
submodules: "recursive"
- name: Build source and wheel
run: |
python -m pip install build
python -m build --outdir=wheelhouse
- name: Upload sdist and wheel to github
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: wheelhouse/*
if-no-files-found: error
build_wheels:
name: Building wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: pypa/cibuildwheel@v2.21
env:
CIBW_SKIP: "pp38-*"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
upload_pypi:
name: Upload to PyPI (manual trigger)
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: "*wheels*"
merge-multiple: true
- name: Install Twine
run: |
python -m pip install --upgrade twine
- name: Upload to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing *.whl *.tar.gz