Indie Developers: Automatic deployment to the Play Store with Bitrise

You can use Bitrise to automate deployment to the app stores. To do this, you will only need to modify your deploy Workflow and add extra Steps. You will also need to connect Bitrise to your app store accounts. Let's dig a bit deeper!

In my previous blog post, I showed how you can quickly set up deployment to your testers using Bitrise and a deploy workflow that puts a version of your app onto a publicly accessible Bitrise website for downloading to a test device. 

As a next step, you can use Bitrise to automate deployment to the app stores. To do this you will only need to modify your deploy Workflow and add extra Steps. You will also need to connect Bitrise to your app store accounts.

Automatic App/Play Store deployment

This diagram shows the flow to the store(s):

There are some extra steps needed to automate the deployment of your app to the stores. They are slightly different for Android and iOS but the essential things you need to do are:

  • Sign your app with your identity
  • Set up API access to the store functionality for deployment of an app
  • Update Bitrise with the credentials needed for signing and API access

The rest of this article is focused on Google Play deployment. 

Triggering your deployment Workflow

As discussed in the previous post on deployment, you can set up a Git tag trigger in Bitrise to kick off your deploy Workflow which now becomes your app store deploy Workflow.

Example of supplying a tag wild card of v*.*.* to trigger the deploy Workflow.

Setting up Google Play automatic deployment

Deploy Workflow changes for Google Play deployment

Your current Workflow for deployment is set up for deployment to bitrise.io and the second half of it looks like this:

Add a Google Play Deploy Step. Having done so, the second half of your Workflow will look like this:

Prerequisites

For the Google Play Deploy Step to operate, these steps must be completed first. The steps prepare the API access on Google Play which is used by Bitrise to deploy your app. 

  1. Upload your first APK or AAB manually to Google Play using the Google Play Console.
  2. Link your Google Play Developer Console to an API project.
  3. Set up API Access clients using a service account and grant the rights to the service account with the Google Play Console.

Step 1 is a manual process that you must carry out. 

Let’s look at what needs to be configured in steps 2 and 3 to allow API control of Google Play Deployment so that Bitrise will be able to automate it for you. 

Setting up Google Play with API access 

Link your API project by either creating a new API project or linking an existing API project. In this tutorial, we’re creating a new one.

  1. Go to your Google Play Console and choose Setup. Then choose API access. In the Linked Google Cloud project section, select Create new project.

2. On the API access page, scroll down to Service accounts and click Create a new service account. Follow the instructions to get to the Google Cloud Platform.

3. On the Google Cloud Platform, click + CREATE SERVICE ACCOUNT on the top menu bar.



4. A 3-step Create service account page comes up, where you have to provide a Service account name first. A Service account ID is automatically generated based on the Service account name you typed. Select Create and Continue.

5. At the Grant this service account access to project step, select Browser in the Role dropdown. Although the second and third steps of the process are marked optional on Google Cloud Platform, those are essential for Bitrise to be able to use the service account access. Select Continue.

6. Fill out the Service account user role and Service account admins role fields of the Grant users access to this service account step. Click DONE.

7. You return to the API Access page of the Google Play Console where you can create a key to your new service account. Bitrise will use the key to authenticate as the service account. Click the Actions ellipsis menu next to the new service account and select Manage keys from the options.

8. You are directed to the KEYS page of the Service accounts. Click the ADD KEY dropdown and select Create new key option.

9. Select JSON as your Key type. Click CREATE. Once you create a key here, it automatically downloads to your local machine and you can upload it to the Code Signing tab of Bitrise. You may close your Google Cloud Platform window as we won’t need it any more.

10. Back on the API access page of Google Play Console you can see your new service account under Service accounts. Click Grant access to link your project to the Google Console. The Google Cloud Platform (GCP) service account will be invited as a user to the Google Play Console, so GCP will have access to your apps in Play Console. Bitrise uses this service account to make changes in the Google Play Console.

11. In the Invite user window, the Email address field is pre-filled. Under Permissions, the default ones are already selected. You can go with these. Click Invite user at the bottom of the page. Click Send Invite on the pop up.

Check out the Google Play Developer API guide if you need more information on the process.

You have successfully prepared your Google Play Console project. A services credential account has been created which is authorized to manage your releases.

Setting up Bitrise to deploy automatically to Google Play

Log in to bitrise.io.

  1. Select your project and go to the Workflow Editor.
  2. Click the Code Signing tab.
  3. If you have not done so previously, access the ANDROID KEYSTORE FILE section and set up your Google Play Key (upload key) on Bitrise.
  4. Upload the service account JSON key into the GENERIC FILE STORAGE.
  5. Copy the env key which stores your uploaded file’s URL.
    For example:
    BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL
  6. Go back to your Workflow Editor and add the Google Play Deploy Step to the end of your Workflow.
  7. Fill out the required input fields which are:
  • Service Account JSON key file path: this field can accept a remote url so you have to provide the environment which contains your uploaded service account JSON key. For example: $BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL.
  • Package name: the package name of your Android app.
  • Track: the track where you want to deploy your app (for example, internal/alpha/beta/production or any custom track you set).

You can use the Play Console UI to promote apps to other tracks (for example, an app uploaded to internal testing can be released on alpha track).

Running auto deployment to Google Play

There has been a lot of configuration and set up to get to this point so let’s recap what we’ve done.

  • We have set up a Git tag trigger on Bitrise for our repository. By pushing a version tag to the repository we can trigger our deploy Workflow to run.
  • We manually deployed the first version of our app to Google Play to set it up.
  • Using Google Play Console and Google Cloud Platform we configured API access to Google Play to allow us to auto deploy the app using Bitrise.
  • We set up Bitrise with the JSON key required to use the API service we set up.
  • We added the Google Play Deploy Step to the deploy Workflow and set it up to have access to the deployment API.

The next step is to run a deploy Workflow including the Google Play Deploy Step. You can do this manually in the Bitrise UI or trigger it by pushing a version tag to your repository. 

Benefits 

  1. With the set up described here, we have created automatic deployment to Google Play from your Bitrise platform. 
  2. You will be able to work on developing your app, and when you are ready to deploy to testers for testing, you simply need to tag a version and push it to your repository
  3. Bitrise will build your app, run automated tests and deploy your new app version to a track on Google Play.
  4. You can use the Google Play Services to make your app available to testers.

Play Store deployment, automated!

No more manual steps: everything is managed in the cloud for you by Bitrise. You have a robust process of getting your apps for testing on Google Play, and you can migrate your app through to publication when you are ready.



No items found.
The Mobile DevOps Newsletter

Explore more topics

App Development

Learn how to optimize your mobile app deployment processes for iOS, Android, Flutter, ReactNative, and more

Bitrise & Community

Check out the latest from Bitrise and the community. Learn about the upcoming mobile events, employee spotlights, women in tech, and more

Bitrise Insights

Cache | Caching

Mobile App Releases

Learn how to release faster, better apps on the App Store, Google Play Store, Huawei AppGallery, and other app stores

Mobile DevOps

Learn Mobile DevOps best practices such as DevOps for iOS, Android, and industry-specific DevOps tips for mobile engineers

Mobile Testing & Security

Learn how to optimize mobile testing and security — from automated security checks to robust mobile testing and more.

Product Updates

Check out the latest product updates from Bitrise — Build Insights updates, product news, and more.

The Mobile DevOps Newsletter

Join 1000s of your peers. Sign up to receive Mobile DevOps tips, news, and best practice guides once every two weeks.