76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
name: Build,download and publish wheels
|
|
on: workflow_dispatch
|
|
jobs:
|
|
build_sdist:
|
|
name: Build source distribution
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# sdist used to compile in user local environment
|
|
- name: Build sdist
|
|
run: pipx run build --sdist
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cibw-sdist
|
|
path: dist/*.tar.gz
|
|
|
|
build_wheels:
|
|
name: Build wheels on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
# macos-13 is closing down, macos-15 is apple silicon
|
|
# macos-15-intel is for the x86_64
|
|
# note: Apple has discontinued support for the x86_64 (Intel) architecture
|
|
os: [ ubuntu-latest, windows-latest, macos-15, macos-15-intel]
|
|
# modify python version in project.toml
|
|
steps:
|
|
# 检出代码
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
# You can test your matrix by printing the current Python version
|
|
- name: Display Python version
|
|
run: python -c "import sys; print(sys.version)"
|
|
- name: Install dependencies
|
|
run: python -m pip install --upgrade pip setuptools wheel build packaging
|
|
|
|
|
|
- name: Build wheels
|
|
uses: pypa/cibuildwheel@v2.23.3
|
|
with:
|
|
output-dir: dist/
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
path: dist/*.whl
|
|
|
|
|
|
upload_pypi:
|
|
needs: [build_wheels, build_sdist]
|
|
runs-on: ubuntu-latest
|
|
environment: pypi
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
# unpacks all CIBW artifacts into dist/
|
|
pattern: cibw-*
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
uses: pypa/gh-action-pypi-publish@v1.12.4
|
|
with:
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
skip-existing: true
|
|
|