Create staging & production environments for a react-native app, using react-native-config.
// .env
IS_PRODUCTION=false
API_HOST=https://api.staging.foobar.com
// .env.staging
IS_PRODUCTION=false
API_HOST=api_host
// .env.production
IS_PRODUCTION=true
API_HOST=api_host
.env
is used for the local environment, while the other two for staging
and production
. The setup uses schemes
on iOS and buildTypes
on Android.
I'm using fastlane
to automate builds & reduce the app release to a one-liner script:
cd fastlane
fastlane ios beta --env=production
Also, I wrote an article that describes the whole process here.