diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml new file mode 100644 index 0000000..1c4f57f --- /dev/null +++ b/.github/workflows/build_and_publish.yml @@ -0,0 +1,88 @@ +name: Build and Publish + +on: + workflow_dispatch: + push: + tags: + - "v*" + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + env: + # ---- Linux ---- + # Build manylinux + musllinux wheels + CIBW_ARCHS_LINUX: "x86_64" + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_2" + + # ---- macOS ---- + # Build Intel, Apple Silicon, and universal2 wheels + CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" + + # ---- Windows ---- + # Build both 32-bit and 64-bit wheels + CIBW_ARCHS_WINDOWS: "AMD64 x86" + + # ---- General settings ---- + # Build wheels for CPython 3.11–3.13 + CIBW_BUILD: "cp311-* cp312-* cp313-*" + + # If needed, skip PyPy or unsupported combos + CIBW_SKIP: "pp* *-manylinux_i686" + + # Output + CIBW_OUTPUT_DIR: "wheelhouse" + + steps: + - uses: actions/checkout@v4 + + - name: Install cibuildwheel + run: pip install cibuildwheel==2.22.0 + + - name: Build wheels + run: cibuildwheel + + - name: Upload wheels as artifacts + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }} + path: wheelhouse/*.whl + + build_sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + run: | + pip install build + python -m build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/*.tar.gz + + publish: + name: Publish to PyPI + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + + - name: Install Twine + run: pip install twine + + - name: Publish to PyPI + run: | + twine upload wheels-*/* sdist/* + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 4a3e741..1342fee 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -2,9 +2,6 @@ name: Build wheels on: workflow_dispatch: - push: - tags: - - "v*" jobs: build_wheels: @@ -15,21 +12,38 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] env: + # ---- Linux ---- + # Build manylinux + musllinux wheels CIBW_ARCHS_LINUX: "x86_64" + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_2" + + # ---- macOS ---- + # Build Intel, Apple Silicon, and universal2 wheels + CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" + + # ---- Windows ---- + # Build both 32-bit and 64-bit wheels + CIBW_ARCHS_WINDOWS: "AMD64 x86" + + # ---- General settings ---- + # Build wheels for CPython 3.11–3.13 + CIBW_BUILD: "cp311-* cp312-* cp313-*" + + # If needed, skip PyPy or unsupported combos + CIBW_SKIP: "pp* *-manylinux_i686" + + # Output + CIBW_OUTPUT_DIR: "wheelhouse" steps: - uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install cibuildwheel run: pip install cibuildwheel==2.22.0 - name: Build wheels - run: cibuildwheel --output-dir wheelhouse + run: cibuildwheel - name: Upload wheels as artifacts uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index a63a1de..908ba29 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- ErrorAlign Logo + ErrorAlign Logo