pyebur128/.github/workflows/build-pypi.yml

98 lines
2.7 KiB
YAML
Raw Normal View History

2021-03-25 20:55:33 +00:00
name: Upload to PyPI
on:
workflow_dispatch:
inputs:
overrideVersion:
description: Manually force a version
env:
CIBW_BUILD_VERBOSITY: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
2024-09-03 19:19:03 +00:00
uses: actions/checkout@v4
2021-03-25 20:55:33 +00:00
with:
submodules: recursive
- name: Setup Python
2024-09-03 19:19:03 +00:00
uses: actions/setup-python@v5
2021-03-25 20:55:33 +00:00
with:
python-version: '3.12'
2021-03-25 20:55:33 +00:00
- name: Install dependencies
run: |
python -m pip install build twine
- name: Build SDist
run: |
python -m build --sdist
- name: Put SDist in artifact container
2024-09-03 19:19:03 +00:00
uses: actions/upload-artifact@v4
2021-03-25 20:55:33 +00:00
with:
name: cibw-sdist
2021-03-25 20:55:33 +00:00
path: dist/*.tar.gz
- name: Check SDist metadata
run: |
twine check dist/*
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
2024-09-03 19:19:03 +00:00
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2021-03-25 20:55:33 +00:00
steps:
- name: Checkout repository
2024-09-03 19:19:03 +00:00
uses: actions/checkout@v4
2021-03-25 20:55:33 +00:00
with:
submodules: recursive
- name: Set up QEMU on Linux images
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
2021-03-25 20:55:33 +00:00
- name: Get Python Version Name
2024-09-03 19:19:03 +00:00
uses: mad9000/actions-find-and-replace-string@5
2021-03-25 20:55:33 +00:00
id: pythonversion
with:
source: ${{ matrix.python }}
find: '.'
replace: ''
- name: "Install Python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'arm64'
uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: 3.8
2021-03-25 20:55:33 +00:00
- name: Build wheels
2024-09-03 19:19:03 +00:00
uses: joerick/cibuildwheel@v2.20.0
2021-03-25 20:55:33 +00:00
env:
CIBW_BUILD: "cp${{ steps.pythonversion.outputs.value }}-*"
2021-03-25 20:55:33 +00:00
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
- name: Upload wheels to artifact container
2024-09-03 19:19:03 +00:00
uses: actions/upload-artifact@v4
2021-03-25 20:55:33 +00:00
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
2021-03-25 20:55:33 +00:00
path: wheelhouse/*.whl
upload_all:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
2021-03-25 20:55:33 +00:00
steps:
- name: Get SDist and wheels from artifact container
2024-09-03 19:19:03 +00:00
uses: actions/download-artifact@v4
2021-03-25 20:55:33 +00:00
with:
pattern: cibw-*
2021-03-25 20:55:33 +00:00
path: dist
merge-multiple: true
- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1