|
| 1 | +name: Build wheels and deploy to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [ published ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build_wheels: |
| 9 | + name: Build wheels for ${{ matrix.os }} |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + env: |
| 12 | + CIBW_BUILD: "cp37-* cp38-* cp39-*" |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 16 | + python-version: [3.9] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + |
| 23 | + - uses: actions/setup-python@v2 |
| 24 | + name: Install Python |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + |
| 28 | + - name: Install cibuildwheel |
| 29 | + run: | |
| 30 | + python -m pip install cibuildwheel==1.10.0 |
| 31 | +
|
| 32 | + - name: Build sdist |
| 33 | + run: | |
| 34 | + python setup.py sdist |
| 35 | +
|
| 36 | + - name: Build wheels |
| 37 | + run: | |
| 38 | + python --version |
| 39 | + python -m cibuildwheel --output-dir wheelhouse |
| 40 | +
|
| 41 | + - uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: wheels |
| 44 | + path: ./wheelhouse |
| 45 | + |
| 46 | + # The pypi upload fails with non-linux containers, so grab the uploaded |
| 47 | + # artifacts and run using those |
| 48 | + # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 |
| 49 | + deploy: |
| 50 | + name: Upload wheels to PyPI |
| 51 | + needs: |
| 52 | + - build_wheels |
| 53 | + runs-on: ubuntu-latest |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Download the wheels |
| 57 | + uses: actions/download-artifact@v2 |
| 58 | + with: |
| 59 | + name: wheels |
| 60 | + path: dist/ |
| 61 | + |
| 62 | + #- name: Publish package to Test PyPi |
| 63 | + # uses: pypa/gh-action-pypi-publish@master |
| 64 | + # with: |
| 65 | + # user: __token__ |
| 66 | + # password: ${{ secrets.TEST_PYPI_PASSWORD }} |
| 67 | + # repository_url: https://test.pypi.org/legacy/ |
| 68 | + |
| 69 | + - name: Publish package to PyPi |
| 70 | + uses: pypa/gh-action-pypi-publish@master |
| 71 | + with: |
| 72 | + user: __token__ |
| 73 | + password: ${{ secrets.PYPI_PASSWORD }} |
0 commit comments