Cyburst.io

Any fool can know. The point is to understand

GitLab CI/CD – Configuring GitLab Variable and Google PlayService Account (Part-3)

Notes: This article is the 3rd part of the “GitLab CI/CD - Android” series. It is direct follow up to Part-1 & 2 , so I highly recommend you read that first before starting.

Setup Google PlayStore Service Account

  1. First, Open the Google Play Console
  2. Select the Settings tab
  3. Expand the Developer account option
  4. Select the API access option. Please be aware that this page could take a few minutes to load.
  5. Click Create Service Account. This will open a pop-up.
  6. Click Google API Console in the pop-up. This will open a new tab in your browser.
  7. Click Create service account. This will open a pop-up. Set the Service account name as you wish, Select Role: Owner, and select KeyType: JSON
  8. Click Create. A file named Google Play Android Developer-XXXXXXXXXX.json will start to download. Save this JSON file. Depending on your browser settings, the file may start to download automatically or ask you for permission to start the download.
  9. Close the pop-up. You’ll see the new service account created. You can close this tab now.
  10. Switch back to the pop-up you left open at step 5. Now click Done.
  11. Under the section Service Accounts → Permissions, click Grant access.
  12. You’ll be redirected to the Users & Permissions page. The new service account should now be listed here.
PlayStore Console Setup
PlayStore Console Setup
- Do NOT edit the Email field.
- Keep Access expiry date selected on Never
- Choose Administrator from the Role dropdown
- Leave all GLOBAL permissions checked
- Click Add user to close the dialogue

This is how we set up a service account for Google PlayStore. Now copy that service email id and get back to Android Studio for the play store release setup

Open app/build.gradle file and add the following block to it.

here we set tracks for our release build like ‘production’, ‘alpha’, ‘beta’ etc. now paste your service account email id that you copy from the developer console. The last and very important option is the jsonFile that allows GitLab to authenticate and upload build directly from Container, so copy the line as it is like file(‘/PlayJson/play-store-key.json’) and paste it into your project. We will dynamically create that file from GitLab CI/CD Variable via .gitlab-ci.yml file.

Setup GitLab CI/CD Variable

  • Open Gitlab.com and select the project that you want to set up a CI/CD Variable.
  • Select Settings > CI/CD option
GitLab Console CI/CD Option
GitLab Console CI/CD Option
  • After that, the following screen will open that asks for the Input variable key and Input variable value. Now open that JSON file that we downloaded while setting up the Google Play Service account. Select and Copy all the content of that file and paste it into the input variable value. now we need an Identifier for this value to set the Input variable key like PLAY_STORE_JSON and click on Save variables to save the value.
GitLab Console Variable Declaration
GitLab Console Variable Declaration
Note: remember this key for future reference. We will use it in our .gitlab-ci.yml file.

here we completed the Service account setup and GitLab CI/CD Variable.

Now we just remain to set up .gitlab-ci.yml file that we will see in the next part. Stay tuned!!!

Cyburst Logo

Don’t miss the latest posts!

We don’t spam! Read our privacy policy for more info.

Rutvik Bhatt

Experienced mobile app developer with a demonstrated history of working in the information technology and services industry. Skilled in Android, React-Native, Flutter, Dialog Flow, Firebase, Cloud Functions. Focused in mobile technologies and software development.

7 thoughts on “GitLab CI/CD – Configuring GitLab Variable and Google PlayService Account (Part-3)

  1. Everyone loves what you guys are up too. This
    sort of clever work and exposure! Keep up the excellent works guys I’ve
    incorporated you guys to my personal blogroll.

  2. Oh my goodness! Incredible article dude! Thank you so
    much, However I am encountering troubles with your RSS. I don’t know why I am unable
    to subscribe to it. Is there anybody else getting
    identical RSS issues? Anybody who knows the answer will you kindly respond?
    Thanx!!

  3. Hey there! I know this is kind of off topic but I was
    wondering which blog platform are you using for this
    site? I’m getting tired of WordPress because I’ve had
    issues with hackers and I’m looking at options for another platform.
    I would be fantastic if you could point me in the direction of a good platform.

  4. Simply want to say your article is as astonishing.
    The clearness to your submit is just nice and that i can think you are a professional in this subject.
    Fine along with your permission allow me to clutch your RSS feed to stay up to date with imminent post.
    Thanks a million and please continue the gratifying work.

  5. Hey there! I’ve been reading your website for some time now
    and finally got the courage to go ahead and give you a shout out from Dallas Texas!
    Just wanted to mention keep up the excellent work!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top