2

I am building a react native app which compiles. I would like not to add the gradle plugin, but directly push my .apk file to the alpha section of google play after a successful test (with travis-ci e.g)

Is there a way to do it?

jsdario
  • 6,477
  • 7
  • 41
  • 75

2 Answers2

0

You may follow this tutorial for Automating Publishing to the Play Store. This allows you to trigger builds on your continuous integration server (i.e. Jenkins) and have them uploaded the Play store for alpha or beta testing, as well as pushing to production directly.

Since you don't want to add the gradle plugin, you can configure a continuous integrations server such as Jenkins. You will need first to setup Google API access.

Setup for Google API access

  1. Inside the Google Play Store for your project, navigate to Settings -> API Access.
  2. There should be a Service Accounts section where you need to click the Create Service Account button. Click on the link shown on the first step to visit the Google Developers Console.
  3. Click on the Create New Client ID button.
  4. Click to create new Service Account. Make sure to also request the .p12 Key File instead of JSON.
  5. You will be prompted to download the .p12 file. Save it somewhere.
  6. Note the service account email associated with this new account. You should see it appear in the Google Developer Console.
  7. Once you are done, go back to the Google Play Developer Console and navigate to the Settings -> API Access. Make sure the checkboxes for Edit store listing, pricing & distribution, Manage Production APKs, and Manage Alpha & Beta APKs are checked for the Google Service account used. (If you intend to upload an alpha or beta SDK through a Google service account, apparently these permissions must be checked according to this discussion.

Setting Up Jenkins (for automating CI builds)

  1. Make sure you have already gone through the process of Building Gradle Projects with Jenkins CI and already have a Jenkins job correctly running. You will only need to install a Jenkins plugin that will allow you to create a build step that will enable the APK generated to be published to the Google Play store directly.
  2. Verify that you've the followed the guide about how to configure Google API access.
  3. Inside Jenkins, go to Manage Jenkins -> Manage Plugins. Assuming the plugin has not yet been installed, select the Available tab and search for the Google Play Android Publisher Plugin.
  4. Navigate to the Credentials section in Jenkins and load the .p12 key file downloaded during the initial setup process of setting up Google API access. A basic walkthrough video also demonstrates how to do this step.
  5. Add a post-build step to your existing Jenkins project.

    a. Make sure to choose the credential name from the drop-down list. It should belong to the Google Play account that manages the app.

    b. Enter path and/or an Ant-style wildcard pattern for the APK. For instance, the example in the screenshot expects the APK to be generated inside **/build/outputs/apk/yourappname*.apk.

    c. Choose what track to which the APKs should be deployed (Alpha, Beta, Production).

    d. You can create release notes before you start the build. If you forget to do this step or your automated process pushes the build, you can edit them later directly on the Google Play Developer Console.

Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
0

I decided to post my solution as an answer, to avoid misleads. There are several ways to publish an APK to the Google Play Store, this solution above was very instructive but I went with https://fastlane.tools/

jsdario
  • 6,477
  • 7
  • 41
  • 75