Skip to main content

Sending to the Play Store

In our previous tutorial the last step of the workflow was to upload our binary file (.aab):


_10
- name: Upload release bundle
_10
uses: actions/upload-artifact@v4
_10
with:
_10
name: app-release
_10
path: android/app/build/outputs/bundle/release/app-release-signed.aab
_10
retention-days: 60

We could manually download this file and upload it to the Play Store but this is a tedious process that can be automated.

Note: You will need to upload your .aab file manually at least once to the Play Store. After this you can automate it.

In the file .github/workflows/app-android.yml we can add the following step:


_10
uses: r0adkll/upload-google-play@v1
_10
with:
_10
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
_10
packageName: [your-bundle-id]
_10
releaseFiles: android/app/build/outputs/bundle/release/app-release-signed.aab
_10
track: production
_10
status: completed
_10
whatsNewDirectory: distribution/whatsnew
_10
debugSymbols: app/intermediates/merged_native_libs/release/out/lib

Additional documentation on settings for this action can be found here.

Replace [your-bundle-id] with the package name of your application. eg com.example.MyApp.

The SERVICE_ACCOUNT_JSON is a secret that you need to create in your GitHub repository. The following are detailed steps to configure access via service account.

Configure Service Account

  1. Enable the Google Play Android Developer API.
    1. Go to https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com.
    2. Click on Enable.
  2. Create a new service account in Google Cloud Platform (docs).
    1. Navigate to https://cloud.google.com/gcp.
    2. Open IAM & Admin > Service accounts > Create service account.
    3. Pick a name for the new account. Do not grant the account any permissions.
    4. To use it from the GitHub Action use either:
      • Account key in GitHub secrets (simpler):
        1. Open the newly created service account, click on keys tab and add a new key, JSON type.
        2. When successful, a JSON file will be automatically downloaded on your machine.
        3. Store the content of this file to your GitHub secrets, e.g. SERVICE_ACCOUNT_JSON.
        4. Set serviceAccountJsonPlainText: ${{ SERVICE_ACCOUNT_JSON }} when using this action.
      • Workload identity authentication (more secure, recommended by GCP):
        1. Configure workload identity provider in the same project as the new service account (docs).
        2. Run a step to obtain short-lived access credentials:

          _10
          - id: auth
          _10
          uses: google-github-actions/auth@v2
          _10
          with:
          _10
          workload_identity_provider: <project>/.../workloadIdentityPools/<provider>
          _10
          service_account: <service-account>@<project>.iam.gserviceaccount.com

        3. Set serviceAccountJson: ${{ steps.auth.outputs.credentials_file_path }} when using this action.
  3. Add the service account to Google Play Console.
    1. Open https://play.google.com/console and pick your developer account.
    2. Open Users and permissions.
    3. Click invite new user and add the email of the service account created in the previous step.
    4. Grant permissions to the app that you want the service account to deploy in app permissions.

Creating your "Whats New"

The whatsNewDirectory in this example supplies changelogs for English, German and Japanese


_10
distribution/
_10
└─ whatsnew/
_10
├─ whatsnew-en-US
_10
├─ whatsnew-de-DE
_10
└─ whatsnew-ja-JP

Summary

Running these steps will allow you to send your app to the Play Store as part of the automated build process.