diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3af8901..07a389c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,36 +119,44 @@ jobs: steps: + - name: Check whether to build wheel + id: should-build-wheel + if: | + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || + matrix.cibw-only == 'cp310-manylinux_x86_64' || + matrix.cibw-only == 'cp310-win_amd64' || + matrix.cibw-only == 'cp310-win32' + run: echo true=1 >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 + if: steps.should-build-wheel.outputs.true - name: Use Python 3.11 + if: steps.should-build-wheel.outputs.true uses: actions/setup-python@v5 with: python-version: '3.11' - name: Set up MSYS2 - if: runner.os == 'Windows' + if: steps.should-build-wheel.outputs.true && runner.os == 'Windows' uses: ./.github/actions/setup-msys2 with: arch: ${{ matrix.arch }} - name: Set up QEMU - if: runner.os == 'Linux' + if: steps.should-build-wheel.outputs.true && runner.os == 'Linux' uses: docker/setup-qemu-action@v2 with: platforms: all - name: Print build identifiers + if: steps.should-build-wheel.outputs.true run: | python -m pip install cibuildwheel==2.17.0 python -m cibuildwheel --only ${{ matrix.cibw-only }} --print-build-identifiers - name: Build wheels - if: | - (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || - matrix.cibw-only == 'cp310-manylinux_x86_64' || - matrix.cibw-only == 'cp310-win_amd64' || - matrix.cibw-only == 'cp310-win32' + if: steps.should-build-wheel.outputs.true uses: pypa/cibuildwheel@v2.17.0 with: only: ${{ matrix.cibw-only }} @@ -156,11 +164,7 @@ jobs: CIBW_ENVIRONMENT: ${{ runner.os == 'Windows' && matrix.arch == 'x86' && 'CC=i686-w64-mingw32-gcc.exe' || '' }} - uses: actions/upload-artifact@v3 - if: | - (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || - matrix.cibw-only == 'cp310-manylinux_x86_64' || - matrix.cibw-only == 'cp310-win_amd64' || - matrix.cibw-only == 'cp310-win32' + if: steps.should-build-wheel.outputs.true with: path: ./wheelhouse/*.whl