Skip to content

Build and upload to PyPI #1

Build and upload to PyPI

Build and upload to PyPI #1

Workflow file for this run

name: Build and upload to PyPI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# Schedule the workflow to trigger at a specified time each day using a CRON expression
# schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# - cron: '25 0 * * *' # Runs at 12:25am UTC every day
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.23.2
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS: auto64
CIBW_SKIP: "*-win32 *-manylinux_i686"
# ...
with:
# package-dir: .
output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
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_all:
needs: [build_wheels, build_sdist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
# CHECK: List the files before publishing
- name: List artifacts before upload
run: |
echo "Listing files in ./dist:"
ls -lh dist/
# Upload to PyPI
#- uses: pypa/gh-action-pypi-publish@release/v1