kinjo 0.1.4

Kinjo: mDNS TUI and commands launch for local network services
Documentation
name: Publish macOS binaries

# Builds native tarballs for both Apple Silicon and Intel Macs, for a Homebrew
# formula to point at. Cross-compiling x86_64-apple-darwin from the arm64
# runner works out of the box: Apple's SDK/linker support both targets from
# either host, so a single macOS runner builds both without extra toolchains.

on:
  release:
    types: [created]
  workflow_dispatch:

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  macos:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v7

      - uses: Swatinem/rust-cache@v2

      - name: Add Rust targets
        run: rustup target add aarch64-apple-darwin x86_64-apple-darwin

      - name: Build and package both targets
        run: |
          version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
          for target in aarch64-apple-darwin x86_64-apple-darwin; do
            cargo build --release --locked --verbose --target "$target"
            name="kinjo-${version}-${target}"
            mkdir -p "$name/commands"
            cp "target/${target}/release/kinjo" "$name/"
            cp README.md LICENSE "$name/"
            cp actions/*.toml "$name/commands/"
            tar -czf "${name}.tar.gz" "$name"
          done

      - name: Upload packages to release
        env:
          GH_TOKEN: ${{ github.token }}
        # github.event.release is only set for the `release` trigger; fall back
        # to the checked-out ref when dispatched manually (see prepare-release.yml).
        run: gh release upload "${{ github.event.release.tag_name || github.ref_name }}" kinjo-*.tar.gz --clobber