From db8ffab805e175bca37f06e8fee86e901998aace Mon Sep 17 00:00:00 2001 From: Ozgur Ersoy Date: Sun, 13 Apr 2025 19:48:32 +0200 Subject: [PATCH] fix(workflows): improve macOS build workflow with absolute path handling and enhanced app bundle search --- .gitea/workflows/test-macos-build.yml | 57 +++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/test-macos-build.yml b/.gitea/workflows/test-macos-build.yml index f2cb0254..7d318f90 100644 --- a/.gitea/workflows/test-macos-build.yml +++ b/.gitea/workflows/test-macos-build.yml @@ -65,6 +65,10 @@ jobs: mkdir -p PackagedReleases echo "Using Unreal Engine 5.5" + + # Get the working directory path for absolute paths + WORKSPACE_DIR="$(pwd)" + echo "WORKSPACE_DIR=$WORKSPACE_DIR" >> "$GITHUB_ENV" shell: bash # Step 2: Build for macOS @@ -95,19 +99,56 @@ jobs: - name: Find App Bundle id: find-app-bundle run: | - # Find app bundle - APP_PATH=$(find Builds -type d -name "*.app" | head -1) + # Find app bundle with absolute path + REL_APP_PATH=$(find Builds -type d -name "*.app" | head -1) - if [ -z "$APP_PATH" ]; then + if [ -z "$REL_APP_PATH" ]; then # Look for a directory that might be a bundle but not named .app - APP_PATH=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1) - if [ -z "$APP_PATH" ]; then + REL_APP_PATH=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1) + if [ -z "$REL_APP_PATH" ]; then echo "No build directory found, cannot continue" exit 1 fi fi - echo "Found app path: $APP_PATH" + # Convert to absolute path + APP_PATH="${WORKSPACE_DIR}/${REL_APP_PATH}" + + echo "Found relative app path: $REL_APP_PATH" + echo "Using absolute app path: $APP_PATH" + + # Verify the path exists + if [ ! -d "$APP_PATH" ]; then + echo "WARNING: Path does not exist: $APP_PATH" + echo "Checking if path exists without workspace prefix..." + + # Sometimes CI systems already provide absolute paths + if [ -d "/$REL_APP_PATH" ]; then + APP_PATH="/$REL_APP_PATH" + echo "Using path: $APP_PATH" + elif [[ "$REL_APP_PATH" == /* ]] && [ -d "$REL_APP_PATH" ]; then + APP_PATH="$REL_APP_PATH" + echo "Using original absolute path: $APP_PATH" + else + # List files in Builds directory for debugging + echo "Contents of Builds directory:" + find Builds -type d | sort + + # Try to find app anywhere in the workspace + echo "Searching for .app files in the workspace:" + APP_PATHS=$(find . -type d -name "*.app" 2>/dev/null) + if [ -n "$APP_PATHS" ]; then + echo "Found potential app bundles:" + echo "$APP_PATHS" + APP_PATH="$(pwd)/$(echo "$APP_PATHS" | head -1)" + echo "Using first result: $APP_PATH" + else + echo "ERROR: Could not find any .app bundles in the workspace" + exit 1 + fi + fi + fi + echo "APP_PATH=$APP_PATH" >> "$GITHUB_ENV" shell: bash @@ -120,7 +161,7 @@ jobs: certificate-data: ${{ secrets.MACOS_CERTIFICATE }} certificate-password: ${{ secrets.MACOS_CERTIFICATE_PWD }} apple-team-id: ${{ secrets.APPLE_TEAM_ID }} - options: --options runtime --deep --timestamp --entitlements ./${{ env.ENTITLEMENTS_FILE }} + options: --options runtime --deep --timestamp --entitlements ${{ env.WORKSPACE_DIR }}/${{ env.ENTITLEMENTS_FILE }} # API Key Notarization (daha güvenli ve modern) apple-api-key: ${{ env.API_KEY_FILE }} apple-api-key-id: ${{ secrets.NOTARY_API_KEY_ID }} @@ -136,7 +177,7 @@ jobs: DIR_PATH=$(dirname "$APP_PATH") echo "Creating final package..." - (cd "$DIR_PATH" && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$APP_NAME") + (cd "$DIR_PATH" && zip -r "${WORKSPACE_DIR}/PackagedReleases/LuckyRobots-macOS.zip" "$APP_NAME") echo "Created packaged release: PackagedReleases/LuckyRobots-macOS.zip" echo "Packaged releases:"