ai-dispatch 8.67.0

Multi-AI CLI team orchestrator
name: Release

on:
  push:
    tags: ["v*"]

permissions:
  contents: write

jobs:
  build:
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            archive: tar.gz
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
            archive: tar.gz
          - target: x86_64-apple-darwin
            os: macos-15
            archive: tar.gz
          - target: aarch64-apple-darwin
            os: macos-15
            archive: tar.gz
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross-compilation tools
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu
          echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

      - name: Build
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package
        shell: bash
        run: |
          tag="${GITHUB_REF#refs/tags/}"
          name="aid-${tag}-${{ matrix.target }}"
          mkdir -p "$name"
          cp "target/${{ matrix.target }}/release/aid" "$name/"
          cp README.md LICENSE "$name/" 2>/dev/null || true
          tar czf "${name}.tar.gz" "$name"

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: aid-${{ matrix.target }}
          path: aid-*.tar.gz

  release:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts
          merge-multiple: true

      - name: Generate checksums
        run: |
          cd artifacts 2>/dev/null || true
          sha256sum aid-*.tar.gz > checksums-sha256.txt

      - name: Generate changelog
        id: changelog
        run: |
          tag="${GITHUB_REF#refs/tags/}"
          prev_tag=$(git tag --sort=-v:refname | grep -v "^${tag}$" | head -1)
          if [ -n "$prev_tag" ]; then
            log=$(git log --pretty=format:"- %s" "${prev_tag}..${tag}" 2>/dev/null || echo "")
          else
            log=$(git log --pretty=format:"- %s" -20)
          fi
          {
            echo "body<<CHANGELOG_EOF"
            echo "## Changes"
            echo ""
            echo "$log"
            echo ""
            echo "## Install"
            echo ""
            echo '```bash'
            echo "curl -fsSL https://aid.agent-tools.org/install.sh | bash"
            echo '```'
            echo ""
            echo "Or download a binary below and place it in your PATH."
            echo "CHANGELOG_EOF"
          } >> "$GITHUB_OUTPUT"

      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          body: ${{ steps.changelog.outputs.body }}
          files: |
            artifacts/aid-*.tar.gz
            artifacts/checksums-sha256.txt
          generate_release_notes: false