Skip to content

Commit 9f24f96

Browse files
committed
Add check for env variable for version name and code
1 parent 475d8ba commit 9f24f96

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ios/upload_sourcemap.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cd ${PROJECT_DIR}
33
cd ..
44
if [ -s "$HOME/.nvm/nvm.sh" ]; then
55
. "$HOME/.nvm/nvm.sh"
6-
elif [ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]; then
6+
elif [ -x "$(command -v brew)" ] && [ -s "$(brew --prefix nvm)/nvm.sh" ]; then
77
. "$(brew --prefix nvm)/nvm.sh"
88
fi
99
export NODE_BINARY=node
@@ -23,13 +23,29 @@ else
2323
echo "CFBundleVersion could not be found, please upload the sourcemap files manually"
2424
exit 0
2525
fi
26+
INSTABUG_APP_VERSION_CODE_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_CODE | cut -d "(" -f2 | cut -d ")" -f1)
27+
if !([ ! "${INSTABUG_APP_VERSION_CODE_ENV}" ] || [ -z "${INSTABUG_APP_VERSION_CODE_ENV}" ]); then
28+
INSTABUG_APP_VERSION_CODE=${!INSTABUG_APP_VERSION_CODE_ENV}
29+
if [ ! "${INSTABUG_APP_VERSION_CODE}" ] || [ -z "${INSTABUG_APP_VERSION_CODE}" ]; then
30+
echo "Environment variable $INSTABUG_APP_VERSION_CODE_ENV was specified inside info.plist but was not found, please upload the sourcemap files manually"
31+
exit 0
32+
fi
33+
fi
2634
fi
2735
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
2836
INSTABUG_APP_VERSION_NAME=$( defaults read ${PRODUCT_SETTINGS_PATH} CFBundleShortVersionString )
2937
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
3038
echo "CFBundleShortVersionString could not be found, please upload the sourcemap files manually"
3139
exit 0
3240
fi
41+
INSTABUG_APP_VERSION_NAME_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_NAME | cut -d "(" -f2 | cut -d ")" -f1)
42+
if !([ ! "${INSTABUG_APP_VERSION_NAME_ENV}" ] || [ -z "${INSTABUG_APP_VERSION_NAME_ENV}" ]); then
43+
INSTABUG_APP_VERSION_NAME=${!INSTABUG_APP_VERSION_NAME_ENV}
44+
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
45+
echo "Environment variable $INSTABUG_APP_VERSION_NAME_ENV was specified inside info.plist but was not found, please upload the sourcemap files manually"
46+
exit 0
47+
fi
48+
fi
3349
fi
3450
VERSION='{"code":"'"$INSTABUG_APP_VERSION_CODE"'","name":"'"$INSTABUG_APP_VERSION_NAME"'"}'
3551
echo "Instabug: Token found" "\""${INSTABUG_APP_TOKEN}"\""

0 commit comments

Comments
 (0)