Skip to content

Commit 5cb562e

Browse files
Merge pull request #531 from Instabug/fix/sourcemap-xcode-version-env-variable
Update Source map upload script
2 parents 5e9084a + 203f0c8 commit 5cb562e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## master
2+
3+
* Adds source map upload script support for environment variables use inside Info.plist
14

25
## v9.1.9 (2020-10-01)
36

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)