Skip to content

Commit

Permalink
check if CI before envFileMissing and exit 1 (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickycodes authored and Bruno Barbieri committed Jan 16, 2020
1 parent c6cc8e6 commit 3435b7c
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ envFileMissing() {
FILE="$1"
echo "'$FILE' is missing, you'll need to add it to the root of the project."
echo "For convenience you can rename '$FILE.example' and fill in the parameters."
echo ""
exit 1
}

displayHelp() {
Expand Down Expand Up @@ -140,7 +142,7 @@ prebuild_android(){
fi
}

buildAndroid(){
buildAndroidRun(){
prebuild_android
react-native run-android
git checkout android/app/fabric.properties
Expand All @@ -153,7 +155,7 @@ buildIosSimulator(){

buildIosDevice(){
prebuild_ios
react-native run-ios --device
react-native run-ios --device
}

buildIosRelease(){
Expand Down Expand Up @@ -207,36 +209,53 @@ buildAndroidRelease(){
fi
}

buildAndroid() {
if [ "$MODE" == "release" ] ; then
buildAndroidRelease
else
buildAndroidRun
fi
}

buildIos() {
if [ "$MODE" == "release" ] ; then
buildIosRelease
else
if [ "$RUN_DEVICE" = true ] ; then
buildIosDevice
else
buildIosSimulator
fi
fi
}

checkParameters "$@"

printTitle

if [ "$PLATFORM" == "ios" ]; then
if [ -f "$IOS_ENV_FILE" ]; then
if [ "$MODE" == "release" ] ; then
buildIosRelease
else
if [ "$RUN_DEVICE" = true ] ; then
buildIosDevice
else
buildIosSimulator
fi
fi
buildIos
else
envFileMissing $IOS_ENV_FILE
# we don't care about env file in CI
if [ "$CI" = "true" ]; then
buildIos
else
envFileMissing $IOS_ENV_FILE
fi
fi



else
if [ -f "$ANDROID_ENV_FILE" ]; then
if [ "$MODE" == "release" ] ; then
buildAndroidRelease
else
buildAndroid
else
# we don't care about env file in CI
if [ "$CI" = "true" ]; then
buildAndroid
else
envFileMissing $ANDROID_ENV_FILE
fi
else
envFileMissing $ANDROID_ENV_FILE
fi
fi

0 comments on commit 3435b7c

Please sign in to comment.