react-native-template-obytes icon indicating copy to clipboard operation
react-native-template-obytes copied to clipboard

How to handle ENV variables for CI?

Open BlvckParrot opened this issue 1 year ago • 4 comments

How do you handle ENV variables for CI runs, without having any .env file in remote repository?

BlvckParrot avatar Jul 12 '24 16:07 BlvckParrot

You just need to add them as global environment variables in your repository, and the script should read them from the system. please try it and let me know in case it's not working as expected

yjose avatar Jul 15 '24 11:07 yjose

@yjose

I just read this guide - https://starter.obytes.com/ci-cd/app-releasing-process/

It says for a QA release I have to run prebuild:staging and then build:staging:__ commands. (Similar flow for production).

It further says:

The above commands will generate the required credentials for the build and store them in EAS servers so that we can use them later to trigger the build from GitHub actions.

Does this mean that for every QA/production release I have to run the build locally -- So that the env variables for a particular environment are updated on the eas servers?

I understand that clientEnv is being added to app.config.ts as follows but how is this made available to the eas servers for different environments?

extra: {
    ...ClientEnv,
    eas: {
      projectId: Env.EAS_PROJECT_ID,
    },
  },

How does eas handle env variables for different environments? I am a little confused with the release flow.

Thank you for this amazing starter! Its a life saver 💟

heyanurag avatar Jul 23 '24 20:07 heyanurag

@heyanurag glad you found the starter useful.

only singing credentials will be added automatically. For other env variables, you should add them manually

yjose avatar Jul 26 '24 15:07 yjose

is it intended that npx create-obytes-app@latest MyApp does not include the .env files in the .gitignore ? I'd assume for security reasons to not check secrets into the repo it would be best practice to include any .env in the .gitignore

Is this handeled by the precommit hooks?

SamuelLHuber avatar Jul 28 '24 10:07 SamuelLHuber

@SamuelLHuber @heyanurag, just added an new section in the docs for more clarity regarding env files and github action https://starter.obytes.com/ci-cd/app-releasing-process/#github-action-and-env-variables

yjose avatar Sep 04 '24 18:09 yjose

@SamuelLHuber @heyanurag, just added an new section in the docs for more clarity regarding env files and github action https://starter.obytes.com/ci-cd/app-releasing-process/#github-action-and-env-variables

The current approach requires manually adding specific configurations to every workflow (e.g., eas build, expo-doctor, lint-ts, test), which is inefficient and prone to errors.

Can you recommend a more efficient way to manage these configurations across all workflows?

joshuadiezmo avatar Jan 25 '25 11:01 joshuadiezmo