fix(up-wip): ios bundle and upload

This commit is contained in:
devthejo 2025-10-05 12:49:35 +02:00
parent 76701774d1
commit 7588a26e5b
8 changed files with 1570 additions and 1647 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View file

@ -25,7 +25,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.13.9</string> <string>1.13.10</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -48,7 +48,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>221</string> <string>222</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
@ -180,4 +180,4 @@
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
</dict> </dict>
</plist> </plist>

View file

@ -2,6 +2,7 @@ require File.join(File.dirname(`node --print "require.resolve('expo/package.json
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require 'json' require 'json'
require 'fileutils'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
@ -15,6 +16,9 @@ prepare_react_native_project!
target 'AlerteSecours' do target 'AlerteSecours' do
use_expo_modules! use_expo_modules!
# Pin TOCropViewController to 2.x for compatibility with RNImageCropPicker 0.40.x
pod 'TOCropViewController', '~> 2.6'
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1' if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"]; config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
@ -65,5 +69,65 @@ target 'AlerteSecours' do
end end
end end
end end
# Ensure correct header destinations for ReactAppDependencyProvider to avoid CpHeader reversing into build/generated
installer.pods_project.targets.each do |t|
if t.name == 'ReactAppDependencyProvider'
t.build_configurations.each do |config|
# Public headers should live inside the framework product, not in the generated sources dir
config.build_settings['PUBLIC_HEADERS_FOLDER_PATH'] = '$(CONTENTS_FOLDER_PATH)/Headers'
# Ensure the generated headers can still be found during compilation
existing = config.build_settings['HEADER_SEARCH_PATHS']
inherited = '$(inherited)'
generated = '$(PROJECT_DIR)/build/generated/ios'
if existing.nil?
config.build_settings['HEADER_SEARCH_PATHS'] = "#{inherited} #{generated}"
elsif existing.is_a?(Array)
config.build_settings['HEADER_SEARCH_PATHS'] = (existing + [generated, inherited]).uniq
else
config.build_settings['HEADER_SEARCH_PATHS'] = "#{existing} #{generated} #{inherited}"
end
end
end
end
# Disable glass effect in TOCropViewController v3 to avoid iOS 18-only APIs at compile time
installer.pods_project.targets.each do |t|
if t.name == 'TOCropViewController'
t.build_configurations.each do |config|
defs = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)']
unless defs.is_a?(Array)
defs = [defs, '$(inherited)']
end
defs << 'TOCROPVIEWCONTROLLER_ENABLE_GLASS_EFFECT=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs.uniq
end
end
end
# Patch TOCropViewController to import iOS 18-only UIKit headers when available.
crop_toolbar_path = File.join(__dir__, 'Pods', 'TOCropViewController', 'Objective-C', 'TOCropViewController', 'Views', 'TOCropToolbar.m')
if File.exist?(crop_toolbar_path)
contents = File.read(crop_toolbar_path)
needle = "#import \"TOCropToolbar.h\"\n"
injection = <<~'IMPORTS'
#if __has_include(<UIKit/UIGlassEffect.h>)
#import <UIKit/UIGlassEffect.h>
#endif
#if __has_include(<UIKit/UICornerConfiguration.h>)
#import <UIKit/UICornerConfiguration.h>
#endif
#if __has_include(<UIKit/UIButtonConfiguration.h>)
#import <UIKit/UIButtonConfiguration.h>
#endif
IMPORTS
unless contents.include?('<UIKit/UIGlassEffect.h>')
FileUtils.chmod('u+w', crop_toolbar_path) unless File.writable?(crop_toolbar_path)
contents = contents.sub(needle, needle + injection)
File.write(crop_toolbar_path, contents)
end
end
end end
end end

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "alerte-secours", "name": "alerte-secours",
"version": "1.13.9", "version": "1.13.10",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "expo start --dev-client --private-key-path ./keys/private-key.pem", "start": "expo start --dev-client --private-key-path ./keys/private-key.pem",
@ -50,8 +50,8 @@
"screenshot:android": "scripts/screenshot-android.sh" "screenshot:android": "scripts/screenshot-android.sh"
}, },
"customExpoVersioning": { "customExpoVersioning": {
"versionCode": 221, "versionCode": 222,
"buildNumber": 221 "buildNumber": 222
}, },
"commit-and-tag-version": { "commit-and-tag-version": {
"scripts": { "scripts": {

View file

@ -12,6 +12,10 @@ export BUILD_TIME=$(date +%s000)
# Clean previous bundle # Clean previous bundle
echo "Cleaning previous bundle..." echo "Cleaning previous bundle..."
rm -f ios/main.jsbundle* rm -f ios/main.jsbundle*
echo "Cleaning previous archive and stale IPA..."
# Keep ios/build because RN 0.79+ stores codegen headers in ios/build/generated/ios needed for archive.
rm -rf ios/AlerteSecours.xcarchive || true
rm -f ios/build/AlerteSecours.ipa || true
# Get version from Info.plist for release naming # Get version from Info.plist for release naming
BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ios/AlerteSecours/Info.plist) BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ios/AlerteSecours/Info.plist)
@ -20,6 +24,9 @@ RELEASE_NAME="com.alertesecours.alertesecours@${PACKAGE_VERSION}+${BUNDLE_VERSIO
# Generate the bundle and sourcemap # Generate the bundle and sourcemap
echo "Generating bundle and sourcemap..." echo "Generating bundle and sourcemap..."
export METRO_DISABLE_FILE_WATCHER=${METRO_DISABLE_FILE_WATCHER:-1}
export CI=${CI:-1}
ulimit -n 4096 2>/dev/null || true
yarn react-native bundle \ yarn react-native bundle \
--platform ios \ --platform ios \
--dev false \ --dev false \
@ -86,6 +93,9 @@ mv ios/main.jsbundle.hbc ios/main.jsbundle
cd ios cd ios
# Ensure RN codegen headers path exists
mkdir -p build/generated/ios
# Create logs directory if it doesn't exist # Create logs directory if it doesn't exist
mkdir -p ../logs mkdir -p ../logs
@ -98,4 +108,15 @@ xcodebuild \
-archivePath AlerteSecours.xcarchive \ -archivePath AlerteSecours.xcarchive \
archive 2>&1 | tee "../logs/ios-archive-$(date +%Y%m%d-%H%M%S).log" archive 2>&1 | tee "../logs/ios-archive-$(date +%Y%m%d-%H%M%S).log"
# Verify archive version matches source Info.plist
echo "Verifying archive version matches source Info.plist..."
ARCHIVE_PLIST="AlerteSecours.xcarchive/Products/Applications/AlerteSecours.app/Info.plist"
ARCHIVE_PKG_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$ARCHIVE_PLIST")
ARCHIVE_BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$ARCHIVE_PLIST")
echo "Source: ${PACKAGE_VERSION} (${BUNDLE_VERSION}) | Archive: ${ARCHIVE_PKG_VERSION} (${ARCHIVE_BUNDLE_VERSION})"
if [ "$PACKAGE_VERSION" != "$ARCHIVE_PKG_VERSION" ] || [ "$BUNDLE_VERSION" != "$ARCHIVE_BUNDLE_VERSION" ]; then
echo "Error: Archive version mismatch. Expected ${PACKAGE_VERSION} (${BUNDLE_VERSION}), got ${ARCHIVE_PKG_VERSION} (${ARCHIVE_BUNDLE_VERSION})."
exit 1
fi
echo "Archive completed successfully at AlerteSecours.xcarchive" echo "Archive completed successfully at AlerteSecours.xcarchive"

View file

@ -11,11 +11,79 @@ echo "ASC_API_KEY_ID: $ASC_API_KEY_ID"
echo "ASC_API_ISSUER_ID: $ASC_API_ISSUER_ID" echo "ASC_API_ISSUER_ID: $ASC_API_ISSUER_ID"
echo "ASC_API_KEY_PATH: $ASC_API_KEY_PATH" echo "ASC_API_KEY_PATH: $ASC_API_KEY_PATH"
# Execute upload command # Verify versions before upload to prevent stale IPA submission
cd ios && xcrun altool --upload-app \ SOURCE_PLIST="ios/AlerteSecours/Info.plist"
--type ios \ ARCHIVE_PLIST="ios/AlerteSecours.xcarchive/Products/Applications/AlerteSecours.app/Info.plist"
--file build/AlerteSecours.ipa \ IPA_PATH="ios/build/AlerteSecours.ipa"
--apiKey $ASC_API_KEY_ID \
--apiIssuer $ASC_API_ISSUER_ID \ if [ ! -f "$SOURCE_PLIST" ]; then
--apiKeyPath $ASC_API_KEY_PATH \ echo "Error: Source Info.plist not found at $SOURCE_PLIST"
--verbose exit 1
fi
if [ ! -f "$ARCHIVE_PLIST" ]; then
echo "Error: Archive Info.plist not found at $ARCHIVE_PLIST"
echo "Hint: Run 'yarn bundle:ios' to create a fresh archive and export."
exit 1
fi
SRC_PKG_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$SOURCE_PLIST")
SRC_BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$SOURCE_PLIST")
ARC_PKG_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$ARCHIVE_PLIST")
ARC_BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$ARCHIVE_PLIST")
echo "Version check:"
echo " Source Info.plist : $SRC_PKG_VERSION ($SRC_BUILD_NUMBER)"
echo " Archive Info.plist : $ARC_PKG_VERSION ($ARC_BUILD_NUMBER)"
if [ "$SRC_PKG_VERSION" != "$ARC_PKG_VERSION" ] || [ "$SRC_BUILD_NUMBER" != "$ARC_BUILD_NUMBER" ]; then
echo "Error: Archive version mismatch with source Info.plist."
echo "Hint: Run 'yarn bundle:ios' to rebuild with the correct versions."
exit 1
fi
if [ ! -f "$IPA_PATH" ]; then
echo "Error: IPA not found at $IPA_PATH"
echo "Hint: Run 'yarn bundle:ios' to export a fresh IPA."
exit 1
fi
# Attempt to read CFBundleShortVersionString and CFBundleVersion from the IPA for extra safety
IPA_PLIST_TMP=$(mktemp -t as_ipa_Info.plist)
unzip -p "$IPA_PATH" "Payload/AlerteSecours.app/Info.plist" > "$IPA_PLIST_TMP" 2>/dev/null || true
if [ -s "$IPA_PLIST_TMP" ]; then
IPA_PKG_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$IPA_PLIST_TMP" 2>/dev/null || echo "")
IPA_BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$IPA_PLIST_TMP" 2>/dev/null || echo "")
echo " IPA Info.plist (from payload): ${IPA_PKG_VERSION:-unknown} (${IPA_BUILD_NUMBER:-unknown})"
if [ -n "$IPA_PKG_VERSION" ] && [ -n "$IPA_BUILD_NUMBER" ]; then
if [ "$SRC_PKG_VERSION" != "$IPA_PKG_VERSION" ] || [ "$SRC_BUILD_NUMBER" != "$IPA_BUILD_NUMBER" ]; then
echo "Error: IPA version mismatch with source Info.plist."
echo "Hint: Run 'yarn bundle:ios' to export a fresh IPA aligned with current versions."
rm -f "$IPA_PLIST_TMP"
exit 1
fi
fi
else
echo "Warning: Could not read Info.plist from IPA payload for verification. Continuing."
fi
rm -f "$IPA_PLIST_TMP"
# Execute upload using xcrun altool with App Store Connect API key
echo "Uploading to App Store Connect using xcrun altool..."
# Use altool with API key authentication
xcrun altool --upload-app \
--type ios \
--file "$IPA_PATH" \
--apiKey "$ASC_API_KEY_ID" \
--apiIssuer "$ASC_API_ISSUER_ID" \
--verbose
if [ $? -eq 0 ]; then
echo "✅ Successfully uploaded IPA to App Store Connect!"
echo "The build will be available in TestFlight once processing is complete."
else
echo "❌ Upload failed. Check the error messages above."
exit 1
fi