Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add env vars mapping in build script #8859

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading