Publish to AppGallery Automatically | appgallery-publisher

Mustafa Yiğit
ProAndroidDev
Published in
2 min readFeb 21, 2022

--

appgallery-publisher

AppGallery is Huawei’s application distribution platform. Many developers are integrating their apps into the Huawei ecosystem and publishing them on AppGallery. But, most of them do this manually using the AppGallery console.

We recently wanted to add AppGallery to our existing CI-CD pipeline. Then I create an app called appgallery-publisher which automatically uploads the given package to AppGallery.

Communication

appgallery-publisher, uses Huawei’s ConnectApi for authenticating to AppGallery. Also, it uses PublishApi to send the latest application info.

Package Types

appgallery-publisher supports both them apk and app bundle package types.

How To

node standalone.js appId=app_id clientId=client_id clientSecret=client_secret artifactPath=path submit=true
--------------------------------------------------------------------
// Params
{
"appId": "app_id"
"submit": "true" (optional),
"client_id": "client_id",
"client_secret": "client_secret",
"artifact_path": "path" (etc: /Users/mustafa.yigit/Desktop/app-release.aab)
}

→ start the app

→ send a post request to /publish endpoint with appId parameter

→ If you want to submit an artifact directly, add submit parameter (optional)

Request
POST -> http://localhost:3000/publish?appId=105596257&submit=true
Body
{
"client_id": "client_id",
"client_secret": "client_secret",
"artifact_path": "path" (etc: /Users/mustafa.yigit/Desktop/app-release.aab)
}
--------------------------------------------------------------------Response - upload only (without submit param)
"result": {
"packageVersion": "98591645147584"
}
--------------------------------------------------
Response - upload & publish (with submit param)
"result": "success"

Python required (deserialize json)

./publisher.sh appId=YOUR_APP_ID clientId=YOUR_CLIENT_ID clientSecret=YOUR_CLIENT_SECRET artifactPath=YOUR_BUNDLE_PATH

# Response
"Result: success"
-------------------------------------------------------------------
# Params
- appId (required)
- clientId (required)
- clientSecret (required)
- artifactPath (required)

That’s it. If you want more details, please check this github repository. If you find any bug or want to give feedback, please open a pull request. And if you think this is helpful, please give ⭐ ️ to the repository.

--

--