GithubHelp home page GithubHelp logo

alankar0416 / android_linux_buildscript Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 16 KB

This is a bash script to delegate building Android APKs and sharing them with stakeholders to a machine because you have better things to do in life !!

Shell 100.00%
android android-application android-app android-build buildsystem ci slack-bot

android_linux_buildscript's Introduction

Bash script to build and share apks over to Slack

This is a bash script to delegate building Android APKs and sharing them with stakeholders to a machine because you have better things to do in life !!

Initial setup

  1. Take up any discarded system(Linux or Mac, come on, do you still use Windows ?) and connect it to your network with a static IP assigned to it. Get your SysAd on it if you feel lazy.
  2. Install your project along with git to any place on that system.
  3. [Optional] Create a new user on that system and give necessary permissions to execute files on your project. You can use any existing user also.
  4. Add the script anyplace in the system(I suggest you keep the script in the root directory to easily access when you ssh into the system)
  5. Change the RELATIVEPATH variable at the first line of the script according to where your Android project is wrt the script.
RELATIVEPATH="ixigo_android/ixigo-app-android/"
  1. Change the build type conditions and variables to suit your need. We at @ixigo have two apps(Trains and Flights) and two versions, so 4 variants in total.Use ar - Release or ad - Debug if you have a single app project. module is the app in a multimodule project remove it if you have a single app. buildcmd is the argument following ./gradlew, change it as per your project, flavors, and requirement. Lastly, apkpath is the path from which to extract generated apks.
if [ "$1" == "tr" ]
then
        module="ixigo-train-app"
        buildCmd=":ixigo-train-app:assembleRelease"
        apkPath="ixigo-train-app/build/outputs/apk/release"
elif [ "$1" == "td" ]
then

Usage:

  1. Login to build server ssh username@IP_ADDRESS_OF_BUILD_SERVER
  2. input password password: zxcv
  3. Sample command to build
./build_android.sh *apk_type* *branch* -m "@CTO @CEO Please check out this build" -u "Alankar"

branch - Branch you want to build. Ex release_ixigo_app_4.0.8 or origin/release_ixigo_app_4.0.8.

apk_type = tr - Train Release, td - Train Debug, fr - Flight Release, fd - Flight Debug. Use as per your own project here.

[Optional] -l as the third argument to disable posting to slack.

[Optional] -M or -m or --message Custom post-build message to be sent after the apks are published. Feel free to add slack handles of channel and users here

[Optional] -u or -U or --user User triggering the build. Good practice to know who sent the post-build message. Feel free to enforce this if Authors are skipping it πŸ˜‰

  1. In case the build system is busy you get a message like: Another user is using the gradleDaemon, do you want to automatically build once they are done (Y/N)?. Enter y or Y and your build will be queued once the build system is free (please do not close the terminal ).

  2. Upon completion builds will be immediately posted over to this channel with File name as apk name (if -l is not provided).

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

PS

I am not an expert in bash. I just learned bash in order to write this script so there may be optimizations which I have missed. If that is the case feel free to add a comment or send an MR πŸ™.

We use it everyday at ixigo and it definitely have made our life easier. Even our PM's can now trigger builds if you tell them the branch name πŸ˜›

I think it's best to be used in a small to medium scale enterprise where while developing apps there are many things that developers need to take care of because they are a part of the Android Team. πŸ’» Sharing timely builds to an internal QA team. Sharing build with Project managers and Design team for review. Sharing builds with your CEOs and CTOs (they better not have bugs). Sharing with third parties…. and the list goes on.

If you think this helped you in any way do let me know. Optimizing and adding more features to this in a never-ending process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.