Publish an Android app with Bitrise

Matteo
2 min readAug 7, 2019

--

Have you already tried Bitrise? Have you created your workflows?
I described my strategy here last time.

Today I show you the workflow I currently use to compile and deploy an Android app, made with React Native in my case.

WF-AndroidStore

Mini-WF: CloneAndPrepare

Workflow which clones the repository and setup the env

The first step of the process is a small workflow that I use only to clone the repository.
It has three steps:
1) Setup ssh key (source)
2) Clone the repository, setting the repository url and the clone directory path, using $GIT_REPOSITORY_URL set inside app settings (source)
3) Execute a bash script as follows:

#!/usr/bin/env bash
# fail if any commands fails
set -e
# launch another script inside my project root folder to setup the machine: install nvm + node and launch yarn
./bitrise-postclone.sh

Small tip: I usually do not flag the option Run if previous Step failed included in each step, in order to make the build quick, skipping steps if something fails.

Mini-WF: AndroidStore

Deploy to Google Play workflow

This is the core workflow, made of all steps required to compile the app and to upload to GooglePlay. Let’s see in detail:
1) Set version of the app, thanks to a global variable set as Env Vars (source)
2) Run gradle task assembleRelease (source)
3) Sign APK using keystore uploaded inside Code signing tab (source)
4) Deploy to Google Play, after set of package name and serviceAccount.json (source)
5) Set a global variable that will be used to log the status of the build. Only if all previous steps are complete then this is executed (source)

Mini-WF: Finish

Publish artifacts created

With this workflow I upload the artefacts produced to Bitrise, so that it’s available inside Artifacts tab.
1) Deploy APK (source). You can also notify user roles through a input variable already in the step
2) Deploy logs, a file containing all echo outputs from my custom scripts (source)

Any questions? Do you want to discover additional details?
Comment here or ping me!

--

--