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:
_10uses: r0adkll/upload-google-play@v1_10with:_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
- Enable the Google Play Android Developer API.
- Go to https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com.
- Click on Enable.
- Create a new service account in Google Cloud Platform (docs).
- Navigate to https://cloud.google.com/gcp.
- Open
IAM & Admin
>Service accounts
>Create service account
. - Pick a name for the new account. Do not grant the account any permissions.
- To use it from the GitHub Action use either:
- Account key in GitHub secrets (simpler):
- Open the newly created service account, click on
keys
tab and add a new key, JSON type. - When successful, a JSON file will be automatically downloaded on your machine.
- Store the content of this file to your GitHub secrets, e.g.
SERVICE_ACCOUNT_JSON
. - Set
serviceAccountJsonPlainText: ${{ SERVICE_ACCOUNT_JSON }}
when using this action.
- Open the newly created service account, click on
- Workload identity authentication (more secure, recommended by GCP):
- Configure workload identity provider in the same project as the new service account (docs).
- Run a step to obtain short-lived access credentials:
_10- id: auth_10uses: google-github-actions/auth@v2_10with:_10workload_identity_provider: <project>/.../workloadIdentityPools/<provider>_10service_account: <service-account>@<project>.iam.gserviceaccount.com
- Set
serviceAccountJson: ${{ steps.auth.outputs.credentials_file_path }}
when using this action.
- Account key in GitHub secrets (simpler):
- Add the service account to Google Play Console.
- Open https://play.google.com/console and pick your developer account.
- Open Users and permissions.
- Click invite new user and add the email of the service account created in the previous step.
- 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
_10distribution/_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.