Skip to content

Upload Python Package to PyPI #24

Upload Python Package to PyPI

Upload Python Package to PyPI #24

Workflow file for this run

name: Upload Python Package to PyPI
on:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.python }} - ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
include:
- os: ubuntu-latest
python: "cp311"
cibw_platform: linux
- os: macos-latest
python: "cp311"
cibw_platform: macos
steps:
- uses: actions/checkout@v4
- name: Build Wheels
uses: pypa/cibuildwheel@v3.1.3
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_PLATFORM: ${{ matrix.cibw_platform }}
CIBW_ARCHS: "x86_64"
CIBW_SKIP: "pp*"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} || cp {wheel} {dest_dir}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair -w {dest_dir} {wheel} || cp {wheel} {dest_dir}"
with:
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
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: dist-${{ matrix.python }} - ${{matrix.os}}
path: dist/*.tar.gz
upload_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4.1.7
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_JPMC_OSS }}