Deploy multiple flavors/packages to Google Play

Hi,

My company recently migrated from Buddybuild, all good so far except deployment. One of our projects has multiple flavors with different package names, and we to be “deploying all” after the Sign APK step.

Buddybuild could detect the flavors, you could select which ones to deploy after every build, and then deployed seamlessly. I can’t figure out how to do that in Bitrise though. Any ideas?

AFAIK, you have $BITRISE_APK_PATH_LIST

with this, you have access to all generated apks, and, at Google play deploy step, you can use it, and “browse” through array.

If you want to have it more semanthic, add a custom Script step and generate your own vars (using envar) with each flavor

2 Likes

Another option is, to have a sequence of Sign APK + Deploy steps, something like:

steps:
...
    - sign-apk@1.2.0:
        inputs:
        - apk_path: /path/to/app1.apk
    - google-play-deploy@1.4.1:
        inputs:
        - service_account_json_key_path: file://path/to/key1.json
        - package_name: my.pkg.one
    - sign-apk@1.2.0:
        inputs:
        - apk_path: /path/to/app2.apk
    - google-play-deploy@1.4.1:
        inputs:
        - service_account_json_key_path: file://path/to/key2.json
        - package_name: my.pkg.two
...

or, if you build the APKs with separate Gradle Runner steps, then you don’t even have to specify the path to the Sign APK step, as it can simply use the output of Gradle Runner (given that it only generates one APK, e.g. for a specific flavor/variant):

    steps:
...
    - gradle-runner@1.8.3:
        inputs:
        - gradle_task: assembleAppOneRelease
    - sign-apk@1.2.0: {}
    - google-play-deploy@1.4.1:
        inputs:
        - service_account_json_key_path: file://path/to/key1.json
        - package_name: my.pkg.one
    - gradle-runner@1.8.3:
        inputs:
        - gradle_task: assembleAppTwoRelease
    - sign-apk@1.2.0: {}
    - google-play-deploy@1.4.1:
        inputs:
        - service_account_json_key_path: file://path/to/key2.json
        - package_name: my.pkg.two
...