name: 'Get Lemonade Version'
description: 'Extract version from CMakeLists.txt - single source of truth'
outputs:
  version:
    description: 'The version string (e.g., 9.0.0)'
    value: ${{ steps.extract.outputs.version }}
runs:
  using: "composite"
  steps:
    - name: Extract version from CMakeLists.txt
      id: extract
      shell: bash
      run: |
        set -e

        # Extract version from CMakeLists.txt
        VERSION=$(sed -n 's/^project(lemon_cpp VERSION \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' CMakeLists.txt)

        if [ -z "$VERSION" ]; then
          echo "ERROR: Could not extract version from CMakeLists.txt"
          exit 1
        fi

        echo "Extracted version: $VERSION"
        echo "version=$VERSION" >> $GITHUB_OUTPUT
        echo "LEMONADE_VERSION=$VERSION" >> $GITHUB_ENV
