oxios 1.23.0

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

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: read
  # `actions: write` lets the `trigger-publish` job dispatch publish.yml
  # via `gh workflow run` (same-repo dispatch works with GITHUB_TOKEN).
  actions: write

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v5

      - uses: oven-sh/setup-bun@v2

      # ─── Build web assets ──────────────────────────────────────────
      - name: Build web assets
        working-directory: web
        run: bun install && bun run build

      # ─── Package and create GitHub Release ───────────────────────
      - name: Package web assets
        run: |
          cd web/dist
          zip -r $GITHUB_WORKSPACE/web-dist.zip .

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          files: web-dist.zip
          generate_release_notes: true

  # ── Build native macOS arm64 binary ───────────────────────────
  #
  # Runs on an Apple Silicon runner (macos-14 = M1). We do NOT
  # cross-compile from Linux: oxios pulls in oxi-sdk/wasmtime with a
  # native JIT and C dependencies that are painful to cross to
  # aarch64-apple-darwin. The binary does NOT embed web assets
  # (RFC-026 removed rust-embed) — it fetches web-dist.zip on first
  # run into ~/.oxios/web/dist/ — so the tarball is just the
  # standalone `oxios` executable.
  #
  # `needs: release` so this uploads to the release the `release` job
  # already created — one owner of release creation, no upload race.
  binary:
    name: Build macOS arm64 binary
    needs: release
    runs-on: macos-14
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Build dist binary
        run: cargo build --profile dist --locked
      - name: Smoke test
        run: ./target/dist/oxios --version
      - name: Package and checksum
        run: |
          set -euo pipefail
          ASSET=oxios-aarch64-apple-darwin.tar.gz
          tar -C target/dist -czf "$ASSET" oxios
          shasum -a 256 "$ASSET" > "$ASSET.sha256"
          ls -lh "$ASSET" "$ASSET.sha256"
      - name: Upload binary to release
        uses: softprops/action-gh-release@v2
        with:
          files: |
            oxios-aarch64-apple-darwin.tar.gz
            oxios-aarch64-apple-darwin.tar.gz.sha256

  # ── Trigger crates.io publish ──────────────────────────────────
  # A Release created with GITHUB_TOKEN does NOT emit a `release: published`
  # event to other workflows (GitHub suppresses this to prevent loops), so
  # publish.yml's `on: release` trigger never fires. Dispatch it explicitly
  # here once the Release is live. publish.yml verifies the Release exists
  # before publishing.
  trigger-publish:
    name: Trigger crates.io publish
    needs: release
    runs-on: ubuntu-latest
    steps:
      # `gh workflow run` resolves the target workflow file from the *local*
      # git checkout, so it needs an actions/checkout step. Without it the
      # job fails with `fatal: not a git repository`.
      - uses: actions/checkout@v5
      - name: Dispatch publish workflow
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh workflow run publish.yml -f dry_run=false
          echo "publish.yml dispatched for $GITHUB_REF_NAME"