|
| 1 | +# This workflow will upload a Python Package using Twine when a release is created |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries |
| 3 | + |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: Build wheels and sdist and upload to PyPI |
| 10 | + |
| 11 | +on: |
| 12 | + release: |
| 13 | + types: [published] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + build_linux_wheels: |
| 20 | + name: Build wheels on standard linux |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + |
| 25 | + - name: Build wheels |
| 26 | + uses: pypa/cibuildwheel@v2.9.0 |
| 27 | + env: |
| 28 | + CIBW_BUILD: "*manylinux*" |
| 29 | + CIBW_SKIP: cp36* pp* |
| 30 | + |
| 31 | + - uses: actions/upload-artifact@v3 |
| 32 | + with: |
| 33 | + path: ./wheelhouse/*.whl |
| 34 | + |
| 35 | + build_musl_wheels: |
| 36 | + name: Build wheels on musl linux |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + |
| 41 | + - name: Build wheels |
| 42 | + uses: pypa/cibuildwheel@v2.9.0 |
| 43 | + env: |
| 44 | + CIBW_BUILD: "*musllinux*" |
| 45 | + CIBW_SKIP: cp36* pp* |
| 46 | + |
| 47 | + - uses: actions/upload-artifact@v3 |
| 48 | + with: |
| 49 | + path: ./wheelhouse/*.whl |
| 50 | + |
| 51 | + build_macosx_wheels: |
| 52 | + name: Build wheels on macosx |
| 53 | + runs-on: macos-latest |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v3 |
| 56 | + |
| 57 | + - name: Build wheels |
| 58 | + uses: pypa/cibuildwheel@v2.9.0 |
| 59 | + env: |
| 60 | + CIBW_BUILD: "*macosx*" |
| 61 | + CIBW_SKIP: cp36* pp* |
| 62 | + |
| 63 | + - uses: actions/upload-artifact@v3 |
| 64 | + with: |
| 65 | + path: ./wheelhouse/*.whl |
| 66 | + |
| 67 | + build_sdist: |
| 68 | + name: Build sdist and upload to PyPI |
| 69 | + needs: [build_linux_wheels, build_musl_wheels, build_macosx_wheels] |
| 70 | + # Just need to build sdist on a single machine |
| 71 | + runs-on: ubuntu-latest |
| 72 | + |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v3 |
| 75 | + |
| 76 | + - uses: actions/setup-python@v3 |
| 77 | + with: |
| 78 | + python-version: "3.11" |
| 79 | + |
| 80 | + - name: Install dependencies |
| 81 | + run: | |
| 82 | + python -m pip install -U pip |
| 83 | + pip install -U numpy setuptools |
| 84 | + pip install -U . |
| 85 | +
|
| 86 | + - name: Download wheels |
| 87 | + uses: actions/download-artifact@v3 |
| 88 | + with: |
| 89 | + path: ./wheels |
| 90 | + |
| 91 | + - name: Build sdist |
| 92 | + run: | |
| 93 | + python setup.py sdist |
| 94 | + ls -l dist |
| 95 | + tar tvfz dist/yet_another_wizz-*.tar.gz |
| 96 | +
|
| 97 | + - name: Copy wheels |
| 98 | + run: | |
| 99 | + echo ls -l wheels |
| 100 | + ls -l wheels |
| 101 | + echo ls -l wheels/artifact |
| 102 | + ls -l wheels/artifact |
| 103 | + cp wheels/artifact/*.whl dist |
| 104 | + echo ls -l dist |
| 105 | + ls -l dist |
| 106 | +
|
| 107 | + - name: Publish package |
| 108 | + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 |
| 109 | + with: |
| 110 | + user: __token__ |
| 111 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments