Automate Deployment to Huawei AppGallery Connect using Fastlane

Shreejan Shrestha
Huawei Developers
Published in
3 min readDec 9, 2020

--

In this tutorial we’re going to learn how we can use Fastlane in order to deploy our apk or aab on Huawei AppGallery. If you haven’t heard of Fastlane, firstly checkout about Fastlane at docs.fastlane.tools to learn more about Fastlane.

If you’ve used Fastlane before, you probably have already been using it to deploy your apps on Google Play or App Store but in this tutorial I’m going to show how we can make use of the huawei_appgallery_connect Fastlane plugin to deploy apps on AGC.

To get started, you will need create an api client. An API client is an identity credential used by AppGallery Connect to manage user access to the AppGallery Connect API. You can create different API clients for different roles. Users with different roles can access the AppGallery Connect API with the corresponding permissions. Before accessing an API, you must create an API client with the permission for accessing the API. The procedure is as follows:

  1. Sign in to AppGallery Connect and select Users and permissions.

2. Go to Api Key > AppGalleryConnect API from the navigation tree on the left and click Create.

3. Set Name to a customized client name, set Roles to the corresponding role, and click Confirm.

Note:

  • Set Project to N/A to define the API client as a team-level one.
  • For details about the mapping between roles and permissions, please refer to Roles and Permissions.

4. After the client is successfully created, record the values of Client ID and Key in the client information list.

Now that we have our client id and client key, we will need to install the huawei_appgallery_connect fastlane plugin using:

fastlane add_plugin huawei_appgallery_connect

Next, on your fastfile you can define a new lane:

The parameters you need to specify are self explanatory. You can find your app id on the app information page on AppGallery Connect.

If you just want to upload your apk/aab file without submitting it for review, you can set submit_for_review to false. You can always submit for review later using the following code:

phase_release_percent: Percentage of target users of release by phase. Enter an integer or decimal greater than 0 and less than 100.

The value can contain up to two decimal places. For a version released by phase, the release percentage must increase gradually for different phases.

phase_release_description : Remarks of the phased release, such as release features, with up to 500 characters.

The description is not displayed to users or Huawei reviewers. It is displayed only on the version information page for your reference.

To update a global version of your app, you can adopt the mode of release by phase. In this mode, the app updates are exposed only to a certain proportion of users first, and then the proportion will be increased slowly to finally cover all users. By exposing app updates only to a small scope of users, you can obtain feedback from these users and adjust your app accordingly before global release, effectively reducing risks that may occur after global release.

I hope this post helps you to automate your app distribution to AppGallery Connect. If you want more information, you can follow the Github page here, or you can write a comment.

References:
AppGallery Connect
Fastlane
Fastlane Huawei AppGallery Connect Plugin

--

--