oxios 0.3.0

Oxios Agent OS — Agent Operating System powered by oxi-sdk
name: Release

on:
  push:
    tags:
      - 'v*'

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    strategy:
      matrix:
        include:
          - os: macos-latest
            target: aarch64-apple-darwin
            name: macos-arm64
          - os: macos-latest
            target: x86_64-apple-darwin
            name: macos-x86_64
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            name: linux-x86_64
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            name: linux-arm64

    name: Build (${{ matrix.name }})
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout oxios
        uses: actions/checkout@v4
        with:
          path: oxios

      - name: Checkout oxi
        uses: actions/checkout@v4
        with:
          repository: a7garden/oxi
          path: oxi
          ref: v0.4.4
          fetch-depth: 1

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
          targets: ${{ matrix.target }}

      - name: Install cross-compilation tools (Linux ARM64)
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2

      - name: Build web assets
        working-directory: oxios/channels/oxios-web/web
        run: bun install && bun run build

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2
        with:
          shared-key: oxios-release-${{ matrix.target }}

      - name: Build release
        working-directory: oxios
        env:
          RUST_BACKTRACE: 1
        run: cargo build --release --target ${{ matrix.target }}

      - name: Strip binary
        working-directory: oxios
        run: strip target/${{ matrix.target }}/release/oxios || true

      - name: Rename binary
        working-directory: oxios
        run: |
          mv target/${{ matrix.target }}/release/oxios target/oxios-${{ matrix.name }}

      - name: Create checksum
        working-directory: oxios
        run: |
          if command -v sha256sum &> /dev/null; then
            sha256sum target/oxios-${{ matrix.name }} > target/oxios-${{ matrix.name }}.sha256
          else
            shasum -a 256 target/oxios-${{ matrix.name }} > target/oxios-${{ matrix.name }}.sha256
          fi

      - name: Get version
        id: version
        working-directory: oxios
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: oxios-${{ matrix.name }}-${{ steps.version.outputs.VERSION }}
          path: |
            oxios/target/oxios-${{ matrix.name }}
            oxios/target/oxios-${{ matrix.name }}.sha256
          retention-days: 30

      - name: Release
        uses: softprops/action-gh-release@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            oxios/target/oxios-${{ matrix.name }}
            oxios/target/oxios-${{ matrix.name }}.sha256
          generate_release_notes: true