I have a build phase script where I want to detect if the app is building locally or in Bitrise, and toggle the path to the Info.plist accordingly. I have tried that approach but it doesn’t seem to work.
Any ideas?
#!/bin/bash
if [[ -x /usr/libexec/PlistBuddy && -z "$BITRISE_IO" ]]; then
echo "Bitrise build"
APP_PATH="${PROJECT_DIR}/${TARGET_NAME}"
echo $APP_PATH
ENVIRONMENT=$(/usr/libexec/PlistBuddy -c 'print BaseUrl' "${APP_PATH}/Resources/Info.plist")
echo "Environment is ${ENVIRONMENT} - read from plist"
else
echo "Local build"
APP_PATH="${BITRISE_SOURCE_DIR}/MyApp"
echo $APP_PATH
ENVIRONMENT="${BASE_URL}"
echo "Environment is ${ENVIRONMENT} - read from env var"
fi