ecency-mobile/appcenter-pre-build.sh

69 lines
1.8 KiB
Bash
Raw Normal View History

2018-12-05 20:46:36 +03:00
#!/usr/bin/env bash
# Creates an .env from ENV variables for use with react-native-config
2019-01-03 22:24:54 +03:00
2019-01-03 22:58:47 +03:00
GOOGLE_JSON_FILE=$APPCENTER_SOURCE_DIRECTORY/android/app/google-services.json
2020-07-16 11:35:15 +03:00
GOOGLE_PLIST_FILE=$APPCENTER_SOURCE_DIRECTORY/ios/GoogleService-Info.plist
2019-01-03 22:38:13 +03:00
2019-01-03 22:51:09 +03:00
printf "%s\n\n" $APPCENTER_SOURCE_DIRECTORY
2019-01-03 22:24:54 +03:00
2019-05-25 13:46:07 +03:00
if [ -e "$GOOGLE_JSON_FILE" ]
then
2019-01-03 22:24:54 +03:00
echo "Updating Google Json"
2020-07-16 11:35:15 +03:00
echo "$GOOGLE_JSON" | base64 --decode > $GOOGLE_JSON_FILE
2019-01-03 22:24:54 +03:00
sed -i -e 's/\\"/'\"'/g' $GOOGLE_JSON_FILE
2019-12-17 21:28:15 +03:00
echo "File content:"
cat $GOOGLE_JSON_FILE
else
echo "Creating and Updating Google Json"
touch $GOOGLE_JSON_FILE
2020-07-16 11:35:15 +03:00
echo "$GOOGLE_JSON" | base64 --decode > $GOOGLE_JSON_FILE
2019-12-17 21:28:15 +03:00
sed -i -e 's/\\"/'\"'/g' $GOOGLE_JSON_FILE
2019-01-03 22:24:54 +03:00
echo "File content:"
cat $GOOGLE_JSON_FILE
2019-05-25 13:46:07 +03:00
fi
2019-01-03 22:24:54 +03:00
2019-01-03 22:51:09 +03:00
printf "google-services json file:\n"
cat $GOOGLE_JSON_FILE
2020-07-16 11:35:15 +03:00
if [ -e "$GOOGLE_PLIST_FILE" ]
then
echo "Updating Google Json"
echo "$GOOGLE_PLIST" | base64 --decode > $GOOGLE_PLIST_FILE
sed -i -e 's/\\"/'\"'/g' $GOOGLE_PLIST_FILE
echo "File content:"
cat $GOOGLE_PLIST_FILE
else
echo "Creating and Updating Google Plist"
touch $GOOGLE_PLIST_FILE
echo "$GOOGLE_PLIST" | base64 --decode > $GOOGLE_PLIST_FILE
sed -i -e 's/\\"/'\"'/g' $GOOGLE_PLIST_FILE
echo "File content:"
cat $GOOGLE_PLIST_FILE
fi
printf "google-services plist file:\n"
cat $GOOGLE_PLIST_FILE
2018-12-06 12:16:08 +03:00
printf "Old .env file:\n"
cat .env
printf "Started script:\n"
2020-09-21 16:04:33 +03:00
ENV_WHITELIST=${ENV_WHITELIST:-"/ACTIVITY|ANALYTICS|WEBSOCKET|BACKEND|API|TOKEN|PIN|USER|URL/"}
2018-12-05 20:46:36 +03:00
printf "Creating an .env file with the following whitelist:\n"
printf "%s\n\n" $ENV_WHITELIST
2018-12-06 12:37:27 +03:00
set | egrep -e $ENV_WHITELIST | egrep -v "^_" | egrep -v "WHITELIST" | egrep -v "USER-DEFINED" > .env
2018-12-05 20:46:36 +03:00
printf "\n.env created with contents:\n"
2018-12-06 12:05:37 +03:00
cat .env
2019-01-03 22:24:54 +03:00
printf "\nEND OF .env\n"
2019-08-01 10:24:15 +03:00
npx jetify
2019-10-14 11:02:34 +03:00
cd ios && pod install && cd ..