Skip to content

Automatically build and publish an Android app via CI

License

Notifications You must be signed in to change notification settings

uncinc/android-ci

Repository files navigation

android-ci

Download

Helper library to automatically build and publish an Android app via CI.

The current library is an internal testing alpha release, more documentation and features will be available in the future. Feature requests are welcome, please submit a Github issue.

Setup

  1. Include the repository, to your root build.gradle add the following contents:
buildscript {
    repositories {
        maven {
            url  "https://releases.uncinc.nl/maven"
        }
    }
    dependencies {
        classpath 'nl.uncinc.androidci:UncIncAndroidCI:0.4'
    }
}
  1. In your app's build.gradle add the following before the android { block:
apply plugin: 'nl.uncinc.androidci'
  1. Replace version code, version name, and the signing config for the release build in the Android config:
android {
    defaultConfig {
        applicationId project.ext.androidci.getApplicationId("nl.uncinc.demo")
        versionCode project.ext.androidci.getVersionCode()
        versionName project.ext.androidci.getVersionName()
    }

    signingConfigs {
        release {
            storeFile = project.ext.androidci.getStoreFile()
            storePassword = project.ext.androidci.getStorePassword()
            keyAlias = project.ext.androidci.getKeyAlias()
            keyPassword = project.ext.androidci.getKeyPassword()
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}
  1. Create a signingProperties file in the build context (example, this as signing.properties):
storePassword=keystorePassword
keyPassword=keyPassword
keyAlias=key0
storeFile=/Full/Path/To/keystore.jks
  1. For building the app use:
./gradlew -Pandroidci.signingProperties=/Full/Path/To/signing.properties -Pandroidci.versionCode=2

Possible properties

Property Purpose Default Value
androidci.signingProperties Full path to the file with the signing configuration. Should be available to CI. android-app-signing.properties (and if it does not exist. The Debug build key)
androidci.versionCode Android versionCode, use an Integer value 1
androidci.versionName Android versionName, should be a String Git hash of the repo
androidci.applicationId Override for application identifier, for multiple app flavours (e.g. Beta release) Parameter given in the android defaultConfig

Release

This package is released to our custom Maven repository, https://releases.uncinc.nl/maven. There is currently no automatic CI, so the workaround is to build the package to a local directory, and sync that to the releases.uncinc.nl server. To build, run:

./gradlew uploadArchives

License

MIT License

Copyright (c) 2020 Unc Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.