Deploy with App Center 2020:
Awesome Step-by-Step Tutorial

What is the App Center?
App Center is a Microsoft tool that automates a mobile application’s lifecycle. It also includes different services to build, distribute, test, and even obtain reports of crashes in the cloud. As part of modern Custom Mobile App Development Services, tools like App Center streamline CI/CD workflows, reduce manual deployment tasks, and enable engineering teams to ship high-quality mobile applications faster and more reliably.
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 when you push certain branches to your repository.
Steps to deploy
Below is a detailed explanation of the steps required to deploy an application to both the Play Store and the 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 required for deployment, but it is recommended to automate the process.
Build
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. To do so, go to the Build section and 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”.

Configuration options
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 automatically increments the build number. The last build number taken into account for increases corresponds to the build number in the App Center, not the one 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 lets us run custom scripts at specific points in the build process. The stages at which these scripts can be run are post-clone, pre-build, and 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 building begins. 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 the project build finishes and all 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 source maps to a Bugsnag account to obtain reports on crashes that occur when 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:


iOS
Sign builds: You need to have this option enabled 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.
Distribute
To distribute the app across different stores, we need to connect our account to the store where we want to deploy. It is necessary to have a first version uploaded to both Android and iOS in order to distribute it through the App Center. For this, we are going to Distribute -> Stores -> Connect to Store.
iOS
In this case, App Store Connect will be selected, and then we will proceed to authentication. Once authenticated, the app previously created in iTunes Connect is selected.

Once connected to the store, we go to the Releases section in Distribute and 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”.
Android
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, we need to create a Google service account that lets us 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 we want to upload, then indicate whether to deploy as Alpha, Beta, or Production.

We then proceed to press the “Next” button until reaching Review and then we press “Publish”.



