All Android apps in FOSSASIA have an apk branch where after a pull request is merged a new apk gets created so that even people who do not know how to setup the app locally can access it. Let’s see how it is done.
Lets get started
Create a bash file in the scripts folder and name it upload-apk.sh
Here is all the code that you require to create an apk in the apk branch.
First thing that we need to do is setup git. So we’ll set the user name and email just like we do when we setup git for the first time in our own systems.
Next we will clone the apk branch of the repository and copy all the files that we need ie the apk and the JSON files.
Next we will create a new branch that contains only the latest apk. After that we will add the APK and then commit all those changes. You can see that the current date and time are printed out in the commit message.
We will delete the current apk branch and then rename the current branch to apk. In the end we will force push to origin since histories are unrelated.
If you have already integrated Travis CI in your repository then you just need to add this line your travis.yml file.
Now every time a PR gets merged in the repository a new apk file is created in the apk branch of your repository.