name: Build iOS libraries

on:
  workflow_dispatch:

jobs:
  build-libraries-ios:
    runs-on: macos-26
    steps:
    - name: Select Xcode
      run: |
        sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer"
        xcodebuild -version
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Prepare macOS
      run: |
        brew update
        brew install autoconf automake cmake libtool ninja pkg-config

    - name: Build iOS libraries
      run: |
        export M4="$(brew --prefix m4)/bin/m4"
        export IOS_SDK_VERSION="26.2"
        scripts/compile_libs/gen_libs.sh build-ios-libs ios

    - name: Upload Artifacts
      uses: actions/upload-artifact@v4
      with:
        name: ddnet-libs-ios
        path: build-ios-libs/ddnet-libs
