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
- A standalone executable file (/script-only branch)
node standalone.js appId=app_id submit=true grantType=client_credentials clientId=client_id clientSecret=client_secret artifactPath=path // Params { "appId": "app_id" "submit": "true" (optional), "grant_type": "client_credentials", "client_id": "client_id", "client_secret": "client_secret", "artifact_path": "path" (etc: /Users/mustafa.yigit/Desktop/app-release.aab) }
- Express service
→ 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 { "grant_type": "client_credentials", "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"
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.
This article was originally published on proandroiddev.com on February 21, 2021