React-native-code-push: Environment variables to build the app from AppCenter

Created on 7 Jun 2018  路  15Comments  路  Source: microsoft/react-native-code-push

Hello guys,
Exist any option to build the app from AppCenter with the correct deployment key depending of the current branch? for example build the app for Staging if the branch is develop or build the app for Production if the branch is master

Thanks in advance and sorry for the question, I can't see any easy way using environment variables or something like that from the build configuration of AppCenter to do that
Best regards, Nicholls

question

Most helpful comment

Hi @jdnichollsc

How can I change the build configuration to use Debug for my develop branch?

If I understood you correctly you just need to create a new shared build scheme Debug:
screen shot 2018-06-08 at 12 35 42 pm
and push changes to your develop branch

Then go to appcenter.ms, select your application -> Build -> develop branch -> Configure Build and choose Debug scheme in Shared Scheme section:
screen shot 2018-06-08 at 12 44 12 pm

Now you'll be able to build your develop branch using Debug configuration.

Please, try this solution and let me know if it was helpful. Also please specify more details/clarifications if I misunderstood you.

All 15 comments

Hi @jdnichollsc, I think you can achieve it by specifying custom Environment variable with correct deployment key for every branch and then use appcenter-pre-build.sh to write it inside Android or iOS application.

Please, let me know if is was helpful for you situation.

@NickToropov thanks for the response! I already made the following configuration https://github.com/Microsoft/react-native-code-push#multi-deployment-testing
But do you have any example to change the deployment name using appcenter-pre-build.sh? I want to use a new deployment called Develop instead of Staging for the development build.

Thanks in advance!

@NickToropov How can I change the build configuration to use Debug for my develop branch?
Example:

ios-setBuildConfiguration { buildConfiguration: 'Debug' }

Thanks in advance, Nicholls

Hi @jdnichollsc

How can I change the build configuration to use Debug for my develop branch?

If I understood you correctly you just need to create a new shared build scheme Debug:
screen shot 2018-06-08 at 12 35 42 pm
and push changes to your develop branch

Then go to appcenter.ms, select your application -> Build -> develop branch -> Configure Build and choose Debug scheme in Shared Scheme section:
screen shot 2018-06-08 at 12 44 12 pm

Now you'll be able to build your develop branch using Debug configuration.

Please, try this solution and let me know if it was helpful. Also please specify more details/clarifications if I misunderstood you.

But do you have any example to change the deployment name using appcenter-pre-build.sh? I want to use a new deployment called Develop instead of Staging for the development build.

please, clarify if Develop deployment belongs to CodePush? If so then you need just to create such deployment with appcenter cli:
appcenter codepush deployment add -a <ownerName>/<appName> Develop
and pass it to release-react command:
appcenter codepush release-react -a <ownerName>/<appName> -d Develop
_Note, that before releasing with codepush cli you should update deployment key in your application and release new version with updated keys._

appcenter-pre-build.sh is executed only during appcenter build process.

Ohh thanks @NickToropov, the example of the scheme is very important, we need that step from the documentation of Multi-Deployment Testing 馃憤

@jdnichollsc glad to hear that I could help you! :)

Hello there!

I want to change "Shared Scheme" in my app in appcenter.ms
But appcenter show me schemes MCourses & MCourses-tvOS
and I don't have any scheme from my workspace or project in the list on appcenter "Build configuration"

How to update this f#$X@ list?
I tried to create new brunch, build project but list still including only 2 items: MCourses & MCourses-tvOS

@jdnichollsc could you know how it works?

screen shot 2018-07-13 at 16 10 56

@MikePodgorniy you need to create the schema from Xcode, publish the changes to the branch and later update the configuration of that branch from appcenter to use that schema :)

@jdnichollsc you are right, it's easy :D
problem was in my "gitlab to bitbucket" solution
thanks

@NickToropov sorry, what's the configuration for Staging? I can see the following issue from AppCenter:
2018-08-24T00:19:09.6933720Z ld: library not found for -lPods-MyApp

@jdnichollsc You can try looking at this https://github.com/Microsoft/react-native-code-push/issues/426

thanks @filiphosko. I fixed my issues using this configuration: https://medium.com/@royprashenjeet25/solution-of-appcenter-codepush-multi-deployment-issue-ios-which-i-have-faced-c149813f84dd

Is there any way to have a shared variable among different configurations?

Is there any existing documentation for Multi-Deployments - we got an app that we want to build once and push to a Dev and QA environment each environment with its own set of "testers" (e.g. Collaborators).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisjrex picture chrisjrex  路  4Comments

EdmundMai picture EdmundMai  路  4Comments

osdnk picture osdnk  路  3Comments

sergey-akhalkov picture sergey-akhalkov  路  4Comments

diegocouto picture diegocouto  路  4Comments