Configuring Google Play API access
In order to allow Codemagic publish applications to Google Play, it is necessary to set up access using Google Play API.
Setting up the service account on Google Play and Google Cloud Platform
In Google Play Console, navigate to Settings > API access and click Create new service account.
This will lead you to the Google Cloud Platform where you can start creating your service account by clicking + Create service account at the top of the page.
In step 1, fill in the Service account details and click Create. The name of the service account will allow you to identify it among other service accounts you may have created.
In step 2, click the Select a role dropdown menu and choose Project > Editor as the role.
In step 3, you can leave the fields blank and click Done.
In the list of created service accounts, identify the account you have just created and click on the menu in the Actions column, then click Create key.
Make sure that the key type is set to
JSONand click Create. Save the key file in a secure location to have it available.
Navigate back to Google Play Console > Settings > API access and click Grant access next to the created account.
On the App permissions tab, add the applications you wish to grant access to.
Go with the default settings for app permissions and click Apply.
On the Account permissions tab, leave everything as is (there is no need to grant the service account Admin access).
Finally, click Invite user to finish setting up the service account on Google Play.
Using the service account with codemagic.yaml
In order to set up publishing to Google Play, you need to encrypt the contents of the service account
JSON key file and add the encrypted value to the Codemagic configuration file.
Navigate to your app settings in the Codemagic UI and click Encrypt environment variables at the bottom of the screen.
Upload or drop the
JSONkey file to the encryption interface and copy the encrypted value.
In your configuration file, set the encrypted value to the
google_playpublishing and commit the changes.
workflows: publish-workflow: name: Publish to Google Play ... publishing: google_play: credentials: Encrypted(...) track: alpha # specify the Google Play destination track
Using the service account with Flutter UI projects
When configuring Flutter projects through the UI, the service account
JSON key file must be uploaded to Codemagic in Google Play publishing settings. Follow the instructions here.