chore(ios): fix bundle scripts
This commit is contained in:
parent
e1d87bb261
commit
ce1ad286cb
4 changed files with 69 additions and 48 deletions
24
DEVELOPER.md
24
DEVELOPER.md
|
|
@ -137,15 +137,25 @@ If you need to install the app manually, you can examine the `install-android.sh
|
|||
|
||||
#### Building and Running
|
||||
|
||||
To build and run the iOS app:
|
||||
To build and run the iOS app:
|
||||
|
||||
```bash
|
||||
# Run in development mode with staging environment
|
||||
yarn ios:staging
|
||||
```bash
|
||||
# Run in development mode with staging environment
|
||||
yarn ios:staging
|
||||
|
||||
# Build for production (uses scripts/ios-archive.sh and scripts/ios-export.sh)
|
||||
yarn bundle:ios
|
||||
```
|
||||
# Build for production (version + clean + archive + export)
|
||||
yarn bundle:ios:build
|
||||
|
||||
# Upload the last build to App Store Connect
|
||||
yarn bundle:ios:upload
|
||||
|
||||
# Build + upload
|
||||
yarn bundle:ios:release
|
||||
```
|
||||
|
||||
Notes on versioning:
|
||||
- `yarn bundle:ios:build` updates iOS `CFBundleShortVersionString` and `CFBundleVersion` to a timestamp in `Europe/Paris` timezone (format `YYYYMMDDHHMM`) before archiving/exporting.
|
||||
- `yarn bundle:ios` is an alias of `yarn bundle:ios:build`.
|
||||
|
||||
The `bundle:ios` command uses the scripts in the `scripts` directory:
|
||||
- `ios-archive.sh` - Archives the iOS app
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
"bundle:ios:archive": "./scripts/ios-archive.sh",
|
||||
"bundle:ios:export": "./scripts/ios-export.sh",
|
||||
"bundle:ios:upload": "./scripts/ios-upload.sh",
|
||||
"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",
|
||||
"bundle:ios:version": "bash ./scripts/ios-set-timestamp-build-number.sh | tail -n 1 | xargs -I{} echo 'iOS version timestamp: {}'",
|
||||
"bundle:ios:build": "yarn bundle:ios:version && yarn bundle:ios:archive && yarn bundle:ios:export",
|
||||
"bundle:ios:release": "yarn bundle:ios:build && yarn bundle:ios:upload",
|
||||
"bundle:ios": "yarn bundle:ios:build",
|
||||
"ios": "expo run:ios",
|
||||
"ios:staging": "dotenv --override -e .env.staging -- yarn run ios",
|
||||
"ios:prod": "dotenv --override -e .env.prod -- yarn run ios",
|
||||
|
|
|
|||
|
|
@ -2,40 +2,9 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
INFO_PLIST_PATH="$PROJECT_ROOT_DIR/ios/AlerteSecours/Info.plist"
|
||||
# Backward compatible wrapper.
|
||||
# Historically this script was TestFlight-specific, but iOS builds now use the same
|
||||
# timestamp versioning for all distribution bundles.
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
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"
|
||||
exec "$SCRIPT_DIR/ios-set-timestamp-build-number.sh"
|
||||
|
|
|
|||
42
scripts/ios-set-timestamp-build-number.sh
Normal file
42
scripts/ios-set-timestamp-build-number.sh
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/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 timestamp version/build number 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-timestamp-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-timestamp-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"
|
||||
|
||||
Loading…
Add table
Reference in a new issue