Specify .env file on build creation

I have several configs set for production and staging through react-native-config. I need to point the relevant .env file on the point of creating the build, is there any workaround for this?

Already tried adding a script as specified in [doc] with envman

1 Like

Hi @Kaniz_92,

Do you have these .env files in the repo? Or where do you have / specify these?

1 Like

Hi @viktorbenei,
I have these .env files in the repository itself.

As the workflow ENVFILE is set, additionally I want overwrite that variable with the one adding on build creation.

What I have done is get the input env variable at Script step and modify the existing one. But it didn’t work though.

Can you please share a bit more details?

In general, you can set Environment Variables for the builds on the Env Vars tab in the Workflow Editor. You can specify “global” / “App” env vars which will be available for every workflow, as well as if you want to you can set workflow specific ones too which will only be available in that specific workflow’s builds.

I have the same or similar issue.
I am using react-native-config and need to set th ENVFILE property.

Locally, i can can run
export ENVFILE=.env.staging
gradlew :app:assemblyRelease

On bitrise, I create a script to use envman and set the variable. I also created another script to test wether it was property set (echo $ENVFILE). Then I run Android Build (which i think essentially runs assemblyRelease). However, the generated apk is still not using my staging configs, which is what ENVFILE is supposed to do.

Any help is greatly appreciated, thanks!

Hi @adetorres,
Could you send me the build’s URL so we can investigate what could cause the issue?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.