2

Is it possible to update environment variable during build process? I need to increase code version before uploading apk to firebase.

I have found a case when you receive the last version from play store and increase it, but in my case I store version inside environment variables

1 Answers1

1

with codemagic.yaml file there are 2 options:

  1. if you need access in the same script block you just export the same variable with a new value
scripts:
  - name: set new value
    script: |
      export MY_VAR=foobar
      ./my_command.sh
  1. you can also make a new value available to any subsequent steps
scripts:
  - name: set new value
    script: |
      echo "MY_VAR=foobar" >> $CM_ENV
  - name: use new value
    script: |
      ./my_command.sh

you can find more information in the doc https://docs.codemagic.io/yaml-basic-configuration/using-environment-variables/#setting-environment-variables-at-build-time

Mikhail Tokarev
  • 2,843
  • 1
  • 14
  • 35