Notes: 09. Release to the Google Play Store
Try writing a changelog for different releases of your app and upload it along with the APK. You can find out more at https://github.com/r0adkll/upload-google-play
To upload a build to the Play Store Console, use the r0adkll/upload-google-play action.
You want to deploy to the Play Store only when you push a commit to the master branch.
Job to Upload to Google Play
To do this, create a new file named play_store_workflow.yml under .github/workflows and add the following code to it:
name: Deploy to Play Store
on:
push:
branches:
- master
jobs:
Then, the build job from check_and_deploy.yml and paste it inside this file.
With the build job in place, you can now create a job to upload the signed AAB to the Play Store.
Add the following code:
deploy-play-store:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: release.aab
- uses: actions/download-artifact@v3
with:
name: mapping.txt
- name: Publish to Play Store internal test track
uses: r0adkll/upload-google-play@v1.1.1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.yourcompany.android.quotes
releaseFiles: app-release-signed.aab
track: internal
changesNotSentForReview: true
mappingFile: mapping.txt
The workflow triggers when you push any change to the master branch. The build job is the same as the one you used in the previous workflow.
The deploy-play-store job does the following:
- Downloads the release APK and mapping file using the actions/download-artifact action.
- Uploads the APK to the internal track and makes it available to 50% of the users on that track.
- Specifies the package name of the app and also the APK and mapping file to upload.
Commit this file and push it to GitHub.
Verify the Uploaded Build
To verify the workflow, push an empty commit to the master branch.
git commit --allow-empty -m "Empty commit"
git push origin master
Once the workflow is complete, visit the Internal track on the Google Play Console.
You’ll see that a build of the app has been published.
If you get an error stating that the package name is already in use on the Play Store:
- Open app/build.gradle
- Change the
applicationIdto something specific to your project.
Additionally, remember to register a new app on Firebase App Distribution and update the package name in the action as well.
Congratulations, you’ve successfully built a complete continuous delivery pipeline using GitHub Actions.