---
name: Build - Steam Link
permissions:
  contents: read

on:
  workflow_call:
    inputs:
      ci_version:
        required: true
        type: string

jobs:
  build:
    env:
      CI_VERSION: ${{ inputs.ci_version }}
    runs-on: ubuntu-22.04

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v5
        with:
          submodules: 'recursive'
          fetch-depth: 1

      - name: Checkout Steam Link SDK
        uses: actions/checkout@v5
        with:
          repository: ValveSoftware/steamlink-sdk
          path: steamlink-sdk
          fetch-depth: 1

      - name: Build binaries
        run: STEAMLINK_SDK_PATH=$PWD/steamlink-sdk scripts/build-steamlink-app.sh

      - name: Upload Binaries
        uses: actions/upload-artifact@v5
        with:
          name: Moonlight-SteamLink-${{ env.CI_VERSION }}
          path: build/deploy-release/*
          if-no-files-found: error
