Skip to content

Everything is working now #70

Everything is working now

Everything is working now #70

name: Python publish wheels to Pypi
# Example from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# publish when a GitHub Release is created
on:
push:
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_SKIP: 'pp* *musl*'
CIBW_ARCHS_LINUX: 'x86_64 aarch64'
CIBW_ARCHS_WINDOWS: 'AMD64 ARM64'
CIBW_ARCHS_MACOS: 'x86_64 arm64'
with:
package-dir: python
- 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@v3
- name: Build sdist
run: cd python && pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: python/dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# publish when a GitHub Release is created
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
# unpacks wheel files into artifacts
pattern: cibw-*
merge-multiple: false
path: artifacts
- name: Copy everything to the dist folder
run: |
mkdir -p dist
for pattern in artifacts/cibw-sdist/* artifacts/cibw-wheels-macos-*/* artifacts/cibw-wheels-ubuntu-*/* artifacts/cibw-wheels-windows-*/*; do
cp -r $pattern dist 2>/dev/null || echo "No files matched $pattern"
done
echo "Content copied to dist."
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/ # to test