on:
  push:
    tags:
      - "v*"

jobs:
  build-cli:
    uses: ./.github/workflows/build-cli.yml

  build-gui:
    uses: ./.github/workflows/build-gui.yml

  build-mcp:
    uses: ./.github/workflows/build-mcp.yml

  build-mcpb:
    uses: ./.github/workflows/build-mcpb.yml

  release:
    needs: [build-cli, build-gui, build-mcp, build-mcpb]
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - uses: actions/download-artifact@v4
        with:
          path: ./artifacts/

      - uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.ref_name }}
          name: Release ${{ github.ref_name }}
          files: ./artifacts/**/*
          generate_release_notes: true
          body: |
            Downloads are available for Microsoft Windows, Apple macOS and Linux. Download the appropriate artifact for your platform below.

            * `aerofly-startgeraet-gui-*` downloads the Aerofly Startgerät Graphical User Interface (GUI) App
            * `aerofly-startgeraet-cli-*` downloads the Aerofly Startgerät Command Line Interface (CLI) Tool
            * `aerofly-startgeraet-mcp-*` downloads the Aerofly Startgerät Model Context Protocol (MCP) Server
            * `aerofly-startgeraet.mcpb` downloads the Aerofly Startgerät Model Context Protocol (MCP) Server Bundle
