react-native-codepush does not update env variables

172 views Asked by At

I changed my .env variables and whenever I run react-native-codepush I still got my old variables in Testflight. I'm going crazy about this problem.

I'll give some background information first.

I'm using these technologies: Azure repo, Azure pipeline, React-Native, react-native-codepush, app center and testflight.

It's setup like this: Whenever there is changes in e.g. my test-branch my pipeline is being triggered to run react-native-codepush. I have no .env variables submitted to my branch, so they are being generated by the variables setup for the pipeline. Also when changes is submitted to the branch Appcenter is being triggered to run a new build as well and also there I have the env variables set to be generated dynamically.

It looks like this:


trigger:
  branches:
    include:
      - test

pool:
  vmImage: 'ubuntu-latest'

  - job: CodePushTest
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/test')
    steps:
      - script: |
          echo "VARIABLE=${VARIABLE}" > .env
          cat .env
          npm install -g appcenter-cli
          yarn install
          appcenter login --token $(APPCENTER_ACCESS)
          appcenter codepush release-react -a NAME-iOS -d Staging --extra-bundler-option="--reset-cache"
          appcenter codepush release-react -a NAME-Android -d Staging --extra-bundler-option="--reset-cache"
          appcenter logout
        displayName: 'Code Push Test'

If I check the cat .env I can clearly see the new correct .env variables.

If using the new build from appcenter in Testflight -> correct env variables. After applying the react-native-codepush update -> the old env variables.

If running react-native-codepush locally while having the .env variables in a .env file locally -> everything behaves as expected and I have the correct env variables in Testflight.

If I then push something new to test branch which triggers the pipeline -> I get the old env variables again.

How can I solve this problem? I do not know what more to test. I've tested with and without the --extra-bundler-option="--reset-cache"

0

There are 0 answers