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/mcp/index.ts --compile --target=bun-linux-x64   --outfile artifacts/mcp/aerofly-startgeraet-mcp-linux
          bun build src/mcp/index.ts --compile --target=bun-macos-x64   --outfile artifacts/mcp/aerofly-startgeraet-mcp-macos-x64
          bun build src/mcp/index.ts --compile --target=bun-macos-arm64  --outfile artifacts/mcp/aerofly-startgeraet-mcp-macos-arm64
          bun build src/mcp/index.ts --compile --target=bun-windows-x64  --outfile artifacts/mcp/aerofly-startgeraet-mcp-windows.exe

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