kanri 0.11.0

Manage your projects within the terminal.
Documentation
name: Build Binary

on:
  release:
    types: [published]
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build:
    name: Build ${{ matrix.target }}
    strategy:
      matrix:
        include:
          - os: macos-latest
            target: x86_64-apple-darwin
            bin: kanri
          - os: macos-latest
            target: aarch64-apple-darwin
            bin: kanri
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            bin: kanri
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            bin: kanri
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            bin: kanri
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            bin: kanri
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            bin: kanri.exe
          - os: windows-latest
            target: aarch64-pc-windows-msvc
            bin: kanri.exe
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Setup Rust Toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Cache dependencies
        uses: swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}
      - name: Install musl tools
        if: contains(matrix.target, 'musl') && !contains(matrix.target, 'aarch64')
        run: |

          sudo apt-get update
          sudo apt-get install -y musl-tools
      - name: Install cross
        if: runner.os == 'Linux' && contains(matrix.target, 'aarch64')
        uses: taiki-e/install-action@v2
        with:
          tool: cross
      - name: Build Release Binary
        shell: bash
        run: |

          if [[ "${{ runner.os }}" == "Linux" && "${{ matrix.target }}" == *"aarch64"* ]]; then
            cross build --release --target ${{ matrix.target }}
          else
            cargo build --release --target ${{ matrix.target }}
          fi
      - name: Prepare release asset
        shell: bash
        run: |

          mkdir -p dist
          if [[ "${{ runner.os }}" == "Windows" ]]; then
            cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/kanri-${{ matrix.target }}.exe"
          else
            cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/kanri-${{ matrix.target }}"
          fi
      - name: Upload as Artifact
        uses: actions/upload-artifact@v4
        with:
          name: kanri-${{ matrix.target }}
          path: dist/*
      - name: Attach binary to release
        if: github.event_name == 'release'
        uses: softprops/action-gh-release@v3
        with:
          files: dist/*
          token: ${{ secrets.GITHUB_TOKEN }}
          fail_on_unmatched_files: true