Skip to content

Commit

Permalink
feat: add env vars mapping in build script (#8859)
Browse files Browse the repository at this point in the history
- add env vars mapping in build script
- add calls to qa and release steps
- update flask function
  • Loading branch information
NicolasMassart authored Mar 6, 2024
1 parent 19c0ea0 commit aa8536e
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,28 @@ remapEnvVariable() {
echo "Successfully remapped $old_var_name to $new_var_name."
}

remapFlaskEnvVariables() {
# remap flask env variables to match what the app expects
remapEnvVariableQA() {
echo "Remapping QA env variable names to match QA values"
remapEnvVariable "SEGMENT_WRITE_KEY_QA" "SEGMENT_WRITE_KEY"
remapEnvVariable "SEGMENT_PROXY_URL_QA" "SEGMENT_PROXY_URL"
remapEnvVariable "SEGMENT_DELETE_API_SOURCE_ID_QA" "SEGMENT_DELETE_API_SOURCE_ID"
remapEnvVariable "SEGMENT_REGULATIONS_ENDPOINT_QA" "SEGMENT_REGULATIONS_ENDPOINT"
}

remapEnvVariableRelease() {
echo "Remapping release env variable names to match production values"
remapEnvVariable "SEGMENT_WRITE_KEY_PROD" "SEGMENT_WRITE_KEY"
remapEnvVariable "SEGMENT_PROXY_URL_PROD" "SEGMENT_PROXY_URL"
remapEnvVariable "SEGMENT_DELETE_API_SOURCE_ID_PROD" "SEGMENT_DELETE_API_SOURCE_ID"
remapEnvVariable "SEGMENT_REGULATIONS_ENDPOINT_PROD" "SEGMENT_REGULATIONS_ENDPOINT"
}

echo "Remapping flask env variable names to match production"
# ios.env/android.env variables
remapEnvVariable "MM_FLASK_MIXPANEL_TOKEN" "MM_MIXPANEL_TOKEN"
remapFlaskEnvVariables() {
echo "Remapping Flask env variable names to match Flask values"
remapEnvVariable "SEGMENT_WRITE_KEY_FLASK" "SEGMENT_WRITE_KEY"
remapEnvVariable "SEGMENT_PROXY_URL_FLASK" "SEGMENT_PROXY_URL"
remapEnvVariable "SEGMENT_DELETE_API_SOURCE_ID_FLASK" "SEGMENT_DELETE_API_SOURCE_ID"
remapEnvVariable "SEGMENT_REGULATIONS_ENDPOINT_FLASK" "SEGMENT_REGULATIONS_ENDPOINT"
}

loadJSEnv(){
Expand Down Expand Up @@ -266,6 +282,9 @@ generateArchivePackages() {
}

buildIosRelease(){

remapEnvVariableRelease

# Enable Sentry to auto upload source maps and debug symbols
export SENTRY_DISABLE_AUTO_UPLOAD="false"
prebuild_ios
Expand Down Expand Up @@ -329,6 +348,7 @@ buildIosReleaseE2E(){
}

buildIosQA(){
remapEnvVariableQA
prebuild_ios

echo "Start QA build..."
Expand All @@ -352,6 +372,8 @@ buildIosQA(){


buildAndroidQA(){
remapEnvVariableQA

if [ "$PRE_RELEASE" = false ] ; then
adb uninstall io.metamask.qa
fi
Expand All @@ -377,6 +399,9 @@ buildAndroidQA(){
}

buildAndroidRelease(){

remapEnvVariableRelease

if [ "$PRE_RELEASE" = false ] ; then
adb uninstall io.metamask || true
fi
Expand Down

0 comments on commit aa8536e

Please sign in to comment.