fix(ios): bundle release version

This commit is contained in:
devthejo 2026-01-12 18:29:30 +01:00
parent 29d7747b51
commit 906e2f194d
2 changed files with 44 additions and 0 deletions

View file

@ -16,6 +16,9 @@
"bundle:ios:export": "./scripts/ios-export.sh", "bundle:ios:export": "./scripts/ios-export.sh",
"bundle:ios:upload": "./scripts/ios-upload.sh", "bundle:ios:upload": "./scripts/ios-upload.sh",
"bundle:ios": "yarn bundle:ios:archive && yarn bundle:ios:export", "bundle:ios": "yarn bundle:ios:archive && yarn bundle:ios:export",
"bundle:ios:testflight:version": "bash ./scripts/ios-set-testflight-build-number.sh",
"bundle:ios:testflight:archive": "yarn bundle:ios:testflight:version && yarn bundle:ios:archive",
"bundle:ios:testflight": "yarn bundle:ios:testflight:archive && yarn bundle:ios:export && yarn bundle:ios:upload",
"ios": "expo run:ios", "ios": "expo run:ios",
"ios:staging": "dotenv --override -e .env.staging -- yarn run ios", "ios:staging": "dotenv --override -e .env.staging -- yarn run ios",
"ios:prod": "dotenv --override -e .env.prod -- yarn run ios", "ios:prod": "dotenv --override -e .env.prod -- yarn run ios",

View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
INFO_PLIST_PATH="$PROJECT_ROOT_DIR/ios/AlerteSecours/Info.plist"
if [ ! -f "$INFO_PLIST_PATH" ]; then
echo "error: Info.plist not found at $INFO_PLIST_PATH" >&2
exit 1
fi
# Generate a unique version/build number for TestFlight in Europe/Paris timezone
# This value will be used for both CFBundleShortVersionString and CFBundleVersion.
# Format: YYYYMMDDHHMM, e.g. 202601121110 (valid as a numeric-only iOS version).
BUILD_NUMBER="$(TZ=Europe/Paris date +%Y%m%d%H%M)"
echo "[ios-set-testflight-build-number] Using build number: $BUILD_NUMBER"
PLISTBUDDY="/usr/libexec/PlistBuddy"
if [ ! -x "$PLISTBUDDY" ]; then
echo "error: $PLISTBUDDY not found or not executable. This script must run on macOS with PlistBuddy available." >&2
exit 1
fi
set_plist_version_key() {
local key="$1"
# Try to set the existing key, or add it if it does not exist yet.
if ! "$PLISTBUDDY" -c "Set :$key $BUILD_NUMBER" "$INFO_PLIST_PATH" 2>/dev/null; then
"$PLISTBUDDY" -c "Add :$key string $BUILD_NUMBER" "$INFO_PLIST_PATH"
fi
}
set_plist_version_key "CFBundleVersion"
set_plist_version_key "CFBundleShortVersionString"
echo "[ios-set-testflight-build-number] Updated CFBundleShortVersionString and CFBundleVersion in $INFO_PLIST_PATH to $BUILD_NUMBER"
# Print the build number on stdout so callers can capture/log it easily.
echo "$BUILD_NUMBER"