|
| 1 | +name: release |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: [published] |
| 5 | +jobs: |
| 6 | + publish: |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 11 | + python-version: ["3.6", "3.7", "3.8", "3.9"] |
| 12 | + # Linux builds don't need to run across different Python versions, |
| 13 | + # they will all be installed under the manylinux action |
| 14 | + exclude: |
| 15 | + - os: ubuntu-latest |
| 16 | + python-version: "3.6" |
| 17 | + - os: ubuntu-latest |
| 18 | + python-version: "3.7" |
| 19 | + - os: ubuntu-latest |
| 20 | + python-version: "3.8" |
| 21 | + - os: ubuntu-latest |
| 22 | + python-version: "3.9" |
| 23 | + # Use the latest Python version as a base for Linux builds |
| 24 | + include: |
| 25 | + - os: ubuntu-latest |
| 26 | + python-version: "3.x" |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + with: |
| 30 | + lfs: true |
| 31 | + submodules: true |
| 32 | + # Tags are needed to compute the current version number |
| 33 | + fetch-depth: 0 |
| 34 | + - name: Set up Python ${{ matrix.python-version }} |
| 35 | + uses: actions/setup-python@v2 |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python-version }} |
| 38 | + - name: Install tox and pypa-build |
| 39 | + run: | |
| 40 | + pip install --upgrade pip |
| 41 | + pip install tox build |
| 42 | + - name: Build sdist |
| 43 | + # Do this before the manylinux build, so the output directory doesn't get created by Docker |
| 44 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 45 | + run: | |
| 46 | + pyproject-build --sdist |
| 47 | + - name: Build manylinux wheels |
| 48 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 49 | + uses: RalfG/[email protected]_x86_64 |
| 50 | + with: |
| 51 | + python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39' |
| 52 | + # Necessary for setuptools_scm to read the version from Git |
| 53 | + system-packages: 'git-lfs' |
| 54 | + - name: Remove non-manylinux wheels |
| 55 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 56 | + # Those are built as intermediate artifacts, but should not be published |
| 57 | + # Since these are built by Docker, they must be removed with sudo |
| 58 | + run: | |
| 59 | + sudo rm -f dist/*-linux*.whl |
| 60 | + - name: Build non-Linux wheels |
| 61 | + if: ${{ matrix.os != 'ubuntu-latest' }} |
| 62 | + run: | |
| 63 | + pyproject-build --wheel |
| 64 | + - name: Publish to PyPI |
| 65 | + env: |
| 66 | + TWINE_USERNAME: "__token__" |
| 67 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 68 | + TWINE_NON_INTERACTIVE: "true" |
| 69 | + run: | |
| 70 | + tox -e release |
0 commit comments