ilmari 0.9.2

Minimal tmux popup radar for coding agents
name: Release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:

permissions:
  contents: write

env:
  BIN_NAME: ilmari

jobs:
  build:
    # Ilmari is a Unix/macOS tmux tool. Release artifacts intentionally cover
    # Linux and macOS only until Windows tmux behavior is implemented and tested.
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            use_cross: true
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            use_cross: true
          - os: macos-15-intel
            target: x86_64-apple-darwin
            use_cross: false
          - os: macos-15
            target: aarch64-apple-darwin
            use_cross: false

    steps:
      - uses: actions/checkout@v5

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Restore Rust cache
        uses: Swatinem/rust-cache@v2
        with:
          shared-key: release-${{ runner.os }}-${{ matrix.target }}
          save-if: ${{ github.event_name != 'pull_request' }}
          cache-on-failure: true

      - name: Setup cross
        if: matrix.use_cross
        uses: taiki-e/setup-cross-toolchain-action@v1
        with:
          target: ${{ matrix.target }}

      - name: Resolve version
        id: version
        shell: bash
        run: scripts/resolve-version.sh

      - name: Build release binary
        run: TARGET=${{ matrix.target }} scripts/build-release.sh

      - name: Package release artifact
        run: TARGET=${{ matrix.target }} VERSION=${{ steps.version.outputs.version }} BIN_NAME=${{ env.BIN_NAME }} scripts/package-release.sh

      - name: Upload workflow artifacts
        uses: actions/upload-artifact@v4
        with:
          name: dist-${{ matrix.target }}
          path: dist/*

      - name: Upload GitHub Release assets
        uses: softprops/action-gh-release@v2
        with:
          files: dist/*

  publish-npm:
    name: Publish npm package
    needs: build
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v5
      - name: Resolve version
        id: version
        shell: bash
        run: scripts/resolve-version.sh
      - uses: actions/setup-node@v5
        if: env.NODE_AUTH_TOKEN != ''
        with:
          node-version: 18
          registry-url: https://registry.npmjs.org
      - name: Publish
        if: env.NODE_AUTH_TOKEN != ''
        working-directory: npm/ilmari
        run: |
          npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
          npm publish --access public
      - name: Skip npm publish
        if: env.NODE_AUTH_TOKEN == ''
        run: echo "NPM_TOKEN is not set; skipping npm publish."