Build and Release #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to release (e.g., 0.1.0)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build-wheels-linux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Copy README to kiru-py | |
| run: cp README.md kiru-py/README.md | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: kiru-py | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: "true" | |
| manylinux: "2_28" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }} | |
| path: kiru-py/dist | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: x86 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| - runner: ubuntu-22.04 | |
| target: armv7 | |
| - runner: ubuntu-22.04 | |
| target: s390x | |
| - runner: ubuntu-22.04 | |
| target: ppc64le | |
| build-wheels-musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Copy README to kiru-py | |
| run: cp README.md kiru-py/README.md | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: kiru-py | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: "true" | |
| manylinux: musllinux_1_2 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-musllinux-${{ matrix.platform.target }} | |
| path: kiru-py/dist | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: x86 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| - runner: ubuntu-22.04 | |
| target: armv7 | |
| build-wheels-windows: | |
| runs-on: ${{ matrix.platform.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| architecture: ${{ matrix.platform.target }} | |
| - name: Copy README to kiru-py | |
| run: cp README.md kiru-py/README.md | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: kiru-py | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: "true" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-${{ matrix.platform.target }} | |
| path: kiru-py/dist | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| - runner: windows-latest | |
| target: x86 | |
| build-wheels-macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Copy README to kiru-py | |
| run: cp README.md kiru-py/README.md | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: kiru-py | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: "true" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }} | |
| path: kiru-py/dist | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: macos-13 | |
| target: x86_64 | |
| - runner: macos-14 | |
| target: aarch64 | |
| build-sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Copy README to kiru-py | |
| run: cp README.md kiru-py/README.md | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: kiru-py | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: kiru-py/dist | |
| build-crate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Package kiru-core | |
| run: cargo package -p kiru | |
| - name: Upload crate | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: crate-kiru-core | |
| path: target/package/kiru-*.crate | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| build-wheels-linux, | |
| build-wheels-musllinux, | |
| build-wheels-windows, | |
| build-wheels-macos, | |
| build-sdist, | |
| build-crate, | |
| ] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v4 | |
| - name: Publish kiru-core to crates.io | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
| run: cargo publish -p kiru | |
| - name: Collect all wheels into kiru-py/all_wheels | |
| run: | | |
| mkdir -p kiru-py/all_wheels | |
| find . -type f -name "*.whl" -exec cp {} kiru-py/all_wheels/ \; | |
| - name: Publish kiru-py to PyPI | |
| uses: PyO3/maturin-action@v1 | |
| env: | |
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| with: | |
| working-directory: kiru-py | |
| command: upload | |
| args: --non-interactive --skip-existing all_wheels/*.whl | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ inputs.version }} | |
| name: Release v${{ inputs.version }} | |
| files: | | |
| wheels-*/* | |
| crate-kiru-core/* |