PyPi Release #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPi Release | ||
on: | ||
workflow_dispatch: | ||
# release: | ||
# types: [published] | ||
# push: | ||
# branches: | ||
# - pypi | ||
# - main | ||
# - python | ||
# pull_request: | ||
# branches: | ||
# - main | ||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.name }} (${{ matrix.python-version }} ${{ matrix.arch }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [cp38, cp39, cp310, cp311] | ||
arch: [x86_64, arm64] | ||
exclude: | ||
- os: ubuntu-latest | ||
arch: arm64 | ||
- os: windows-latest | ||
arch: arm64 | ||
include: | ||
- os: ubuntu-latest | ||
name: Linux | ||
- os: windows-latest | ||
name: Windows | ||
- os: macOS-latest | ||
name: macOS | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
# to supply options, put them in 'env', like: | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: "10.14" | ||
CIBW_ARCHS: auto64 | ||
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | ||
CIBW_BUILD: ${{ matrix.python-version }}-* | ||
CIBW_SKIP: "cp36-* cp37-* pp* *musllinux* *manylinux1* *-win32 *linux_i686 *linux_aarch64 *linux_ppc64le *linux_s390x" | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build sdist | ||
run: pipx run build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
upload_pypi: | ||
name: Upload to PyPI | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
# upload to PyPI on every tag starting with 'v' | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
# alternatively, to publish when a GitHub Release is created, use the following rule: | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
# unpacks default artifact into dist/ | ||
# if `name: artifact` is omitted, the action will create extra parent dir | ||
name: artifact | ||
path: dist | ||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
# To test: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
# To release: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||