App Center is a tool that was developed by Microsoft that lets a mobile application’s lifecycle be automated. It also includes different services to build, distribute, test, and even obtain reports of crashes in the cloud.
This document’s main objective is to guide you through the necessary steps to deploy your code in an automated manner. This will let you automatically deploy after pushing certain branches to your repository.
Below you can find a detailed explanation of the necessary steps to deploy an application in both the Play Store and App Store.
In the first place, you will need an existing application in the app center in order to carry out the different configurations. In this case, one will be created for Android and one for iOS.
After selecting “Add new app” the following screen will appear:
We need to: type in the name of the application, select the Release Type between the Production, Beta, and Store options, select the operating system for which it will be developed (in this case, we are going to create one for Android and another for iOS) and then choose the platform on which the project is developed. Finally, select “Add new app”.
Once the application is created in the App Center, the steps to deploy in the different stores are explained in detail. It is important to note that the first step explained in the document (Build) is not necessary to deploy, but it is recommended in order to automate the process.
This section illustrates the necessary settings to Build your project in the App Center for both Android and iOS. The first thing you must do is to link the app to the project’s repository. In order to do so, you must go to the Build section and then select the service where it is located. In our case, we will be using Bitbucket.
After this, select the branch where you want to configure the Build and then press “Configure Build”.
Build frequency: this option allows you to configure the build automatically each time a change is made on the selected branch or allows you to build your project manually.
Automatically increment build number (version code, for Android): This option allows you to increment the build number automatically. The last build number that is taken into account to increase, corresponds to the build number within the App Center and not the one found in the store.
This means you need to be extra careful when enabling this option if you already have a deployed version.
Distribute builds: enabling this option allows the app to be distributed to the store or to the collaborators assigned to the app after the build has been generated. To see how to do this please go to the distribute section.
Build scripts: This option allows us to run custom scripts at certain times of the build process. The stages where these scripts can be run are: post-clone, pre-build, post-build.
Post-clone: It runs immediately after the project is cloned. To run post-clone, add the script on the same level as appcenter-post-clone.sh.
Pre-build: It is executed before starting to build. For apps developed in React Native, it is run before generating the source maps. To run pre-build, add the script to the project on the same level as appcenter-pre-build.sh.
Post-build: It is executed after finishing the project build and after all the corresponding files have been generated. To run post-build, add the script to the project on the same level as appcenter-post-build.sh.
Here you can upload the source maps to a bugsnag account in order to obtain reports on the crashes that occur while using the corresponding build.
Below is an example of a possible post-build to upload the source maps to bugsnag after the build is complete:
Sign builds: You need to have this option enabled to be able to run the app on a real device.
For this, a Provisioning Profile and a Certificate must be uploaded. Both must be created for distribution if you want to upload the build to the App Store or Testflight.
They can be obtained from the following link.
To distribute the app in the different stores, it is necessary to connect our account to the one where we want to deploy. It is necessary to have a first version uploaded, both for Android and iOS, in order to distribute them through the App Center. For this, we are going to Distribute -> Stores -> Connect to Store.
In this case, App Store Connect will be selected and then we will proceed to authentication. Once authenticated, the app that has been previously created in iTunes Connect is selected.
Once connected to the store, we go to the Releases section within Distribute, and we select the one we want to upload.
Then we select Store, and option 1: Production if you want to upload it to the App Store or option 2: App Store Connect Users if you want to upload it to iTunes Connect.
Select “Next” until reaching Review and then select “Publish”.
In this case, Google Play will be selected and then we will proceed to authentication. In order to do this, you need a security code that must be requested to the creator of the Google Play account to which the applications are deployed.
To obtain this code, it is necessary to create a Google service account that allows us to interact with the Google API without using our own credentials.
Then we type in the App Package Name and press Assign.
Once the app is linked to the Google account, it can be deployed to the Play Store. What needs to be done is similar to what we did for iOS. First, we must select the Release that we want to upload, and then we have to indicate whether we want to deploy as Alpha, Beta, or Production.
We then proceed to press the “Next” button until reaching Review and then we press “Publish”.
Leave a Reply