From 7ba0cec04f1d90d14a412a470917718d84d224d6 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 2 Jul 2026 11:39:28 +0800 Subject: [PATCH] Fix: Improve iOS app file search with multiple fallback methods and verbose output --- .github/workflows/build-debug.yml | 58 +++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index eb85c8d..2b2bd06 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -121,17 +121,61 @@ jobs: - name: Find and upload iOS Debug App run: | cd iOS-SwiftUI-Code - # 查找生成的 .app 文件 - APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1) - if [ -n "$APP_PATH" ]; then - echo "Found app at: $APP_PATH" + + # 显示 DerivedData 目录结构 + echo "Searching for .app files in DerivedData..." + find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d + + # 显示 Build 目录结构 + echo "Searching for .app files in Build directory..." + find ./build -name "*.app" -type d || echo "No build directory found" + + # 尝试多个可能的路径 + APP_PATH="" + + # 方法1: 从 DerivedData 查找 + APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "SFI.app" -type d | head -n 1) + + # 方法2: 如果没找到,查找任何 .app 文件 + if [ -z "$APP_PATH" ]; then + APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1) + fi + + # 方法3: 从 Build 目录查找 + if [ -z "$APP_PATH" ]; then + APP_PATH=$(find ./build -name "*.app" -type d | head -n 1) + fi + + # 方法4: 使用 xcodebuild 显示构建产物路径 + if [ -z "$APP_PATH" ]; then + echo "Getting build settings to find target build dir..." + BUILD_DIR=$(xcodebuild -project uuvpn.xcodeproj -scheme SFI -showBuildSettings | grep "TARGET_BUILD_DIR" | cut -d '=' -f 2 | tr -d ' ') + echo "TARGET_BUILD_DIR: $BUILD_DIR" + if [ -n "$BUILD_DIR" ] && [ -d "$BUILD_DIR" ]; then + APP_PATH=$(find "$BUILD_DIR" -name "*.app" -type d | head -n 1) + fi + fi + + if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then + echo "✅ Found app at: $APP_PATH" + echo "App size:" + du -sh "$APP_PATH" + + # 复制到 build 目录 mkdir -p build cp -R "$APP_PATH" build/ - # 创建 zip 文件以便上传 + + # 创建 zip 文件 cd build - zip -r ios-debug-app.zip *.app + APP_NAME=$(basename "$APP_PATH") + zip -r ios-debug-app.zip "$APP_NAME" + + echo "✅ Created zip file: ios-debug-app.zip" + ls -lh ios-debug-app.zip else - echo "No .app file found" + echo "❌ No .app file found in any location" + echo "Listing all files in DerivedData..." + ls -R ~/Library/Developer/Xcode/DerivedData/uuvpn*/Build/Products/ || true exit 1 fi