diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3a48b3..fef1965 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,28 +5,134 @@ on: tags: - "v*" jobs: - build: - name: Build Distributions + build-sdist: + name: Build sdist runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Build sdist + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + command: sdist + args: --out dist + + - name: Upload sdist + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheels-sdist + path: dist/ + if-no-files-found: error + build-linux: + name: Build wheel (linux-${{ matrix.target }}) + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + target: [x86_64, aarch64] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - name: Set up uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + - name: Build wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 with: - version: "latest" - enable-cache: false + target: ${{ matrix.target }} + manylinux: auto + args: --release --locked --out dist --compatibility pypi + + - name: Upload wheel + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheels-linux-${{ matrix.target }} + path: dist/ + if-no-files-found: error + + build-musllinux: + name: Build wheel (musllinux-${{ matrix.target }}) + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Build wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + target: ${{ matrix.target }} + manylinux: musllinux_1_2 + args: --release --locked --out dist --compatibility pypi + + - name: Upload wheel + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheels-musllinux-${{ matrix.target }} + path: dist/ + if-no-files-found: error + + build-macos: + name: Build wheel (macos-${{ matrix.platform.target }}) + runs-on: ${{ matrix.platform.runner }} + strategy: + fail-fast: false + matrix: + platform: + - runner: macos-15-intel + target: x86_64 + - runner: macos-latest + target: aarch64 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: "3.10" - - name: Build distributions - run: uv build + - name: Build wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + target: ${{ matrix.platform.target }} + args: --release --locked --out dist --compatibility pypi - - name: Upload distributions + - name: Upload wheel uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: dists + name: wheels-macos-${{ matrix.platform.target }} + path: dist/ + if-no-files-found: error + + build-windows: + name: Build wheel (windows-x64) + runs-on: windows-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: "3.10" + + - name: Build wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + target: x64 + args: --release --locked --out dist --compatibility pypi + + - name: Upload wheel + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheels-windows-x64 path: dist/ if-no-files-found: error @@ -35,11 +141,19 @@ jobs: runs-on: ubuntu-latest permissions: id-token: write # for Trusted Publishing - needs: build + needs: + [build-sdist, build-linux, build-musllinux, build-macos, build-windows] environment: release steps: + - name: Download all artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: wheels-* + path: dist/ + merge-multiple: true + - name: Set up uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 with: @@ -47,12 +161,5 @@ jobs: enable-cache: false ignore-empty-workdir: true - - name: Download distributions - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: dists - path: dist/ - - name: Publish - run: | - uv publish --trusted-publishing always dist/* + run: uv publish --trusted-publishing always dist/*