Configuring Google Play API access
How to set up a Google Play service account for Codemagic
In order to allow Codemagic to 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 service account’s name 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 Basic > 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 Manage keys.
In the Keys section, click Add Key > Create new 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 (Financial data permissions can be left blank).
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.
JSONkey file in an IDE of your choice and copy the contents, then proceed to paste the contents of your
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 projects configured with the Flutter workflow editor
When configuring Flutter projects through the workflow editor, the service account
JSON key file must be uploaded to Codemagic in Google Play publishing settings. Follow the instructions here.