Skip to content

Saral v1.0 release steps from source code

Dileep Gadiraju edited this page Dec 14, 2021 · 16 revisions

Source Code references

Open Terminal and clone source code git clone https://github.com/Sunbird-Saral/Project-Saral.git

Change Directory to Project-Saral/ folder and switch to release tag as per release notes. git checkout tags/<tag_name>

%FRONTEND_FOLDER% = Project-Saral/v1.0/frontend

%BACKEND_FOLDER% = Project-Saral/v1.0/backend

Saral v1.0 Android App bundling/Packaging

  1. Follow Frontend Setup steps @ Developer Environment Setup

  2. Open Terminal in %FRONTEND_FOLDER%/SaralApp/android folder

./gradlew clean

  1. APK Signing can be enabled using the below Gradle files. Make sure the Keystore file is to be used for signing placed in FRONTEND_FOLDER%/SaralApp/android/app folder.

%FRONTEND_FOLDER%/SaralApp/android/gradle.properties

MYAPP_RELEASE_STORE_FILE=my-upload-key.keystore

MYAPP_RELEASE_STORE_PASSWORD=tarento@mis

MYAPP_RELEASE_KEY_ALIAS=hwrecog-key-alias

MYAPP_RELEASE_KEY_PASSWORD=tarento@mis

%FRONTEND_FOLDER%/SaralApp/android/app/build.gradle

Note: Make sure signingConfig signingConfigs.release line is uncommented.

    signingConfigs {
          release {
         if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
             storePassword MYAPP_RELEASE_STORE_PASSWORD
             keyAlias MYAPP_RELEASE_KEY_ALIAS
             keyPassword MYAPP_RELEASE_KEY_PASSWORD

             // Optional, specify signing versions used
               v1SigningEnabled true
               v2SigningEnabled true
         }
     }
         debug {
             storeFile file('debug.keystore')
             storePassword 'android'
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
     }

    buildTypes {
        debug {
            signingConfig signingConfigs.release
        }
        release {
            signingConfig signingConfigs.release
            debug {
                debuggable true
            }
        }
    }

  1. Update google-services.json file in %FRONTEND_FOLDER%/SaralApp/android/app folder.

  2. Open Terminal in %FRONTEND_FOLDER%/SaralApp/android folder

./gradlew assembleRelease

(OR)

./gradlew assembleDebug

  1. You can find release apk file in Project-Saral/v1.0/frontend/SaralApp/android/app/build/outputs/apk/release folder.

Note: If releasing APK file for a client/implementation, recommended creating a sub-branch(say v1.0.0-beta.1-up-apk) from release tag and modify implementation-specific Base URL.

  1. Open terminal from %FRONTEND_FOLDER%/SaralApp/android folder and execute the below command to verify if apk signature.

jarsigner -verbose -verify ./app/build/outputs/apk/release/app-release.apk

How do I create a self-signed certificate to sign Android App APK ?

  1. Make sure java is installed and $JAVA_HOME/bin is in the system $PATH

  2. Open Terminal in the folder where self-signed certificate to be generated and execute below command. keytool -genkey -v -keystore <keystore filename> -alias <alias name> -keyalg RSA -storetype PKCS12 -keysize <size> -validity <validity in days>

Example: keytool -genkey -v -keystore saral-release.keystore -alias odisha-saral-app -keyalg RSA -storetype PKCS12 -keysize 2048 -validity 10000

  1. set of questions like Keystore password, first name, last name, organisational unit, organisation, City/Locality, state, country code will be asked. please enter all these details in order to generate Keystore file.

  2. On successful execution of above keytool command generates Keystore file in current directory.

Sign already generated APK file with private Key

Execute below command from terminal:

$ANDROID_HOME/build-tools/{build-tool-version}/apksigner sign --ks <keystore.jks> --out <saral-release-signed.apk> <saral-app-unsigned-aligned.apk>

OR

%ANDROID_HOME%/build-tools/{build-tool-version}/apksigner sign --ks <keystore.jks> --out <saral-release-signed.apk> <saral-app-unsigned-aligned.apk>

Example:

$ANDROID_HOME/build-tools/30.0.2/apksigner sign --ks my-release-key.jks --out saral-release-signed.apk saral-app-unsigned-aligned.apk

Generate Saral backend docker image release archive

Open Terminal from %BACKEND_FOLDER% folder.

docker build . -t saral-backend:<<release tag>>

docker save saral-backend:<<release tag>> | gzip > saral-backend-<<release tag>>.tar.gz

Example for <<release tag>> is 1.0.0-beta1

Load Saral backend image from the release archive

docker load -i saral-backend-<<release tag>>.tar.gz

Example: docker load -i saral-backend-1.0.0-beta1.tar.gz

Clone this wiki locally