2121 version : ${{ steps.get_version.outputs.version }}
2222 release_exists : ${{ steps.check_release.outputs.exists }}
2323 changelog : ${{ steps.generate_changelog.outputs.CHANGELOG }}
24+ cached_object_version : ${{ steps.cache_object_version.outputs.object_version }}
2425 steps :
2526 - name : Checkout repo (full history)
2627 uses : actions/checkout@v4
@@ -103,12 +104,48 @@ jobs:
103104 echo "Resolving Swift package dependencies for prostore..."
104105 xcodebuild -resolvePackageDependencies -project prostore.xcodeproj -scheme prostore -configuration Release
105106
106- - name : Try building archive, auto-fix objectVersion on future-format error
107+ - name : Try cached objectVersion first, then fallback to candidates
108+ id : cache_object_version
107109 run : |
108110 set -e
109111 ARCHIVE_PATH="$PWD/build/prostore.xcarchive"
110112 mkdir -p build
113+
114+ # Try to read cached objectVersion from file
115+ CACHE_FILE=".object_version_cache"
116+ CACHED_VERSION=""
111117 candidates=(77 70 63 60 56 55)
118+
119+ if [ -f "$CACHE_FILE" ]; then
120+ CACHED_VERSION=$(cat "$CACHE_FILE" | tr -d '\n')
121+ echo "Found cached objectVersion: $CACHED_VERSION"
122+
123+ # Test the cached version first
124+ echo "----- Testing cached objectVersion = $CACHED_VERSION -----"
125+ /usr/bin/perl -0777 -pe "s/objectVersion = \\d+;/objectVersion = $CACHED_VERSION;/" -i.bak prostore.xcodeproj/project.pbxproj || true
126+
127+ set +e
128+ xcodebuild clean archive \
129+ -project prostore.xcodeproj \
130+ -scheme prostore \
131+ -archivePath "$ARCHIVE_PATH" \
132+ -sdk iphoneos \
133+ -configuration Release \
134+ CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO
135+ rc=$?
136+ set -e
137+
138+ if [ $rc -eq 0 ]; then
139+ echo "✅ Cached objectVersion $CACHED_VERSION works!"
140+ echo "object_version=$CACHED_VERSION" >> $GITHUB_OUTPUT
141+ echo "$CACHED_VERSION" > "$CACHE_FILE"
142+ exit 0
143+ else
144+ echo "❌ Cached objectVersion $CACHED_VERSION failed, trying other candidates..."
145+ fi
146+ fi
147+
148+ # If no cache or cached version failed, try all candidates
112149 build_ok=0
113150 for v in "${candidates[@]}"; do
114151 echo "----- Attempting build with objectVersion = $v -----"
@@ -127,15 +164,17 @@ jobs:
127164 rc=$?
128165 set -e
129166 if [ $rc -eq 0 ]; then
130- echo "xcodebuild succeeded with objectVersion = $v"
167+ echo "✅ xcodebuild succeeded with objectVersion = $v"
168+ echo "object_version=$v" >> $GITHUB_OUTPUT
169+ echo "$v" > "$CACHE_FILE"
170+ echo "Cached successful objectVersion: $v"
131171 build_ok=1
132172 break
133173 else
134- echo "xcodebuild failed (exit $rc). Logging last 200 lines from DiagnosticReports (if present):"
135- tail -n 200 /Users/runner/Library/Logs/DiagnosticReports/* 2>/dev/null || true
136- echo "Trying next objectVersion..."
174+ echo "❌ xcodebuild failed (exit $rc). Trying next objectVersion..."
137175 fi
138176 done
177+
139178 if [ "$build_ok" -ne 1 ]; then
140179 echo "ERROR: All objectVersion attempts failed. Dumping debug info:"
141180 echo "===== project.pbxproj header ====="
0 commit comments