-1

I'm trying to get .NET 10 Maui app to build and publish to testflight. I've been trying for hours now with AI. But it can't figure out how to make it work. This is my yml now after many many many attempts.

name: Build and Deploy MAUI iOS

on:
  push:
    branches: [ "master" ]

jobs:
  build:
    runs-on: macos-26 # Use the most stable recent runner
    defaults:
      run:
        working-directory: RekenAvontuurApp 
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '10.0.x' # Since you are targeting net10.0-ios

      - name: Install MAUI Workload
        run: dotnet workload install maui --ignore-failed-sources

      - name: Import Apple Certificate (.p12)
        uses: apple-actions/import-codesign-certs@v3
        with:
          p12-file-base64: '${{ secrets.P12_CERTIFICATE }}'
          p12-password: '${{ secrets.P12_PASSWORD }}'

      - name: Download Provisioning Profile
        run: |
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp Platforms/iOS/*.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/

      - name: Restore Dependencies
        run: dotnet restore

      - name: Select Xcode 26.2
        run: |
          # Point directly to the 26.2 version available on macos-26 runner
          XCODE_PATH="/Applications/Xcode_26.2.0.app"
          
          if [ -d "$XCODE_PATH" ]; then
            sudo xcode-select -s "$XCODE_PATH/Contents/Developer"
            echo "Successfully selected Xcode 26.2"
          else
            echo "Xcode 26.2 not found at $XCODE_PATH. Listing available versions:"
            ls -d /Applications/Xcode_*.app
            exit 1
          fi
          xcodebuild -version

      - name: Patch Xcode Version Metadata
        run: |
          # 1. Locate the real Xcode Info.plist
          XCODE_PATH=$(xcode-select -p | sed 's|/Contents/Developer||')
          INFO_PLIST="$XCODE_PATH/Contents/Info.plist"
          
          echo "Patching Xcode version at $INFO_PLIST"
          
          # 2. Force the version strings to 26.2
          sudo plutil -replace CFBundleShortVersionString -string "26.2" "$INFO_PLIST"
          sudo plutil -replace CFBundleVersion -string "26.2" "$INFO_PLIST"
          
          # 3. Verify the change
          xcodebuild -version

      - name: Build and Publish (IPA)
        run: |
          # 1. Reset Xcode to the default standard path on this runner
          sudo xcode-select -r
          REAL_XCODE=$(xcode-select -p | sed 's|/Contents/Developer||')
          echo "Active Xcode: $REAL_XCODE"

          # 2. Find project
          PROJECT_PATH=$(find . -name "RekenAvontuurApp.csproj" | head -n 1)

          # 3. Aggressive Path Overrides
          # We set these as environment variables AND as properties
          export MD_APPLE_SDK_ROOT="$REAL_XCODE"
          export AppleSdkRoot="$REAL_XCODE"
          export XCODE_DEVELOPER_DIR_PATH="$REAL_XCODE/Contents/Developer"

          dotnet publish "$PROJECT_PATH" \
            -f net10.0-ios \
            -c Release \
            -p:ArchiveOnBuild=true \
            -p:EnableCodeSigning=true \
            -p:CodesignKey="Apple Distribution" \
            -p:CodesignProvision="rekenavontuur" \
            -p:RuntimeIdentifier=ios-arm64 \
            -p:MD_APPLE_SDK_ROOT="$REAL_XCODE" \
            -p:AppleSdkRoot="$REAL_XCODE" \
            -p:MtouchExtraArgs="--explicit-xcode-path=$REAL_XCODE" \
            -p:_IgnoreXcodeVersionCheck=true \
            -p:VerifyXcodeVersion=false \
            -o ./publish

      - name: Upload to TestFlight
        uses: apple-actions/upload-testflight-build@v1
        with:
          app-path: RekenAvontuurApp/publish/*.ipa # Corrected path relative to repo root
          issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
          api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
          api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.