on:
  workflow_call: # Called via release.yml

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Install dependencies
        run: bun install

      - name: Build executables
        run: |
          bun build src/cli/index.ts --compile --target=bun-linux-x64    --outfile artifacts/cli/aerofly-startgeraet-cli-linux
          bun build src/cli/index.ts --compile --target=bun-macos-x64    --outfile artifacts/cli/aerofly-startgeraet-cli-macos-x64
          bun build src/cli/index.ts --compile --target=bun-macos-arm64  --outfile artifacts/cli/aerofly-startgeraet-cli-macos-arm64
          bun build src/cli/index.ts --compile --target=bun-windows-x64  --outfile artifacts/cli/aerofly-startgeraet-cli-windows.exe

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: cli-artifact
          path: ./artifacts/cli/
