From fd56fa341d5a2b6690a03f8842b685dd6c8300c8 Mon Sep 17 00:00:00 2001
From: Michal Neubauer <michal.neubauer@quanti.cz>
Date: Wed, 24 Nov 2021 15:32:52 +0100
Subject: [PATCH 1/3] FEAT: signing config

---
 .gitlab-ci.yml                   | 56 +++-----------------------------
 app/build.gradle                 | 14 +++++++-
 app/src/main/AndroidManifest.xml |  3 +-
 3 files changed, 19 insertions(+), 54 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eacdbc2..5516c74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,8 +11,7 @@ image: artifactory.quanti.cz/docker/builder-android:v2
 # todo: versioning
 variables:
   ARTIFACT_PATH: ./app/build/outputs/apk/*/beneficiary-app-*.apk
-  ARTIFACT_DEBUG_PATH: ./app/build/outputs/apk/*/beneficiary-app-*debug.apk
-  ARTIFACT_RELEASE_PATH: ./app/build/outputs/apk/*/beneficiary-app-*release-unsigned.apk
+  ARTIFACT_RELEASE_PATH: ./app/build/outputs/apk/*/beneficiary-app-*release.apk
   EMULATOR_TIMEOUT: "60"
 
 stages:
@@ -31,7 +30,6 @@ stages:
     # - envsubst < ./app/google-services-template.json > ./app/google-services.json
     - mkdir -p ./app/keystore
     - echo $BASE64_RELEASE_KEYSTORE | base64 -d > ./app/keystore/release.keystore
-    - echo $BASE64_DEBUG_KEYSTORE | base64 -d > ./app/keystore/debug.keystore
     # - echo $FIREBASE_APP_DISTRIBUTION_ADMIN | base64 -d > ./app/adc.json;
       # export GOOGLE_APPLICATION_CREDENTIALS=./app/adc.json;
     - chmod +x gradlew  
@@ -51,35 +49,13 @@ ktlint:
     - ./gradlew ktlint
 
 # Just build application
-build_debug_job:
-  stage: build
-  extends: .gradle_build
-  script:
-    - ./gradlew assembleDebug
-# Just build application
-
 build_release_job:
   stage: build
   extends: .gradle_build
   script:
     - ./gradlew assembleRelease
 
-# Build debug and archive apk
-archive_debug_job:
-  stage: archive
-  extends: .gradle_build
-  script:
-    - ./gradlew :app:assembleDebug
-  when: manual
-  except:
-    - tags
-  artifacts:
-    when: always
-    expire_in: 4 week
-    paths:
-      - $ARTIFACT_PATH
-
-# Build debug and archive apk
+# Build release and archive apk
 archive_release_job:
   stage: archive
   extends: .gradle_build
@@ -94,22 +70,7 @@ archive_release_job:
     paths:
       - $ARTIFACT_PATH
 
-
-# Build debug and archive apk
-archive_debug_job_automatically:
-  stage: archive
-  extends: .gradle_build
-  script:
-    - ./gradlew :app:assembleDebug
-  only:
-    - tags
-  artifacts:
-    when: always
-    expire_in: 4 week
-    paths:
-      - $ARTIFACT_PATH
-
-# Build debug and archive apk
+# Build release and archive apk
 archive_release_job_automatically:
   stage: archive
   extends: .gradle_build
@@ -140,15 +101,6 @@ upload_to_artifactory_automatically:
   only:
     - tags
 
-upload_to_firebase:
-  stage: firebase
-  extends: .gradle_build
-  script:
-    - ./gradlew --build-cache clean
-        app:assembleDebug app:appDistributionUploadDebug
-  when: manual
-
-
 publish_to_playstore:
   stage: publish
   extends: .gradle_build
@@ -169,7 +121,7 @@ upload_release_candidate:
   stage: upload_aws
   variables:
     APP_NAME: support-app
-    APK: $ARTIFACT_DEBUG_PATH
+    APK: $ARTIFACT_RELEASE_PATH
   extends: .release_rc
   when: manual
   environment:
diff --git a/app/build.gradle b/app/build.gradle
index 5ccc18b..587aae9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,7 +16,7 @@ def gitVersionCode = { ->
 
 def VERSION_MAJOR = 2
 def VERSION_MINOR = 1
-def VERSION_PATCH = 0
+def VERSION_PATCH = 1
 
 String APK_NAME = "beneficiary-app"
 String VERSION_NAME = "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
@@ -45,16 +45,28 @@ android {
         buildConfigField "String", "APP_ID", "\"$APP_ID\""
     }
 
+    signingConfigs {
+        release {
+            storeFile file("$RELEASE_STORE_FILE_PATH")
+            keyAlias "$RELEASE_STORE_KEY_ALIAS"
+            storePassword "$RELEASE_STORE_PASSWORD"
+            keyPassword "$RELEASE_STORE_KEY_PASSWORD"
+        }
+    }
+
     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+            signingConfig signingConfigs.release
         }
     }
+
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
+
     kotlinOptions {
         jvmTarget = '1.8'
     }
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0ade357..7216a80 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,11 +11,12 @@
 
     <application
         android:name=".App"
-        android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
+        android:icon="@mipmap/ic_launcher"
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/Theme.Beneficiaryapp"
+        android:testOnly="false"
         android:allowBackup="false"
         tools:replace="android:allowBackup">
 
-- 
GitLab


From 99c708b8a95075b88ab870dfd96c3dc3b8180b8a Mon Sep 17 00:00:00 2001
From: Michal Neubauer <michal.neubauer@quanti.cz>
Date: Wed, 24 Nov 2021 15:34:07 +0100
Subject: [PATCH 2/3] FIX: gradle.properties.template

---
 gradle.properties.template | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gradle.properties.template b/gradle.properties.template
index 2618e3d..77ac151 100644
--- a/gradle.properties.template
+++ b/gradle.properties.template
@@ -6,6 +6,11 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
 APP_ID=${APP_ID}
 MASTER_KEY=${MASTER_KEY}
 
+RELEASE_STORE_FILE_PATH=${RELEASE_STORE_FILE_PATH}
+RELEASE_STORE_KEY_ALIAS=${RELEASE_STORE_KEY_ALIAS}
+RELEASE_STORE_PASSWORD=${RELEASE_STORE_PASSWORD}
+RELEASE_STORE_KEY_PASSWORD=${RELEASE_STORE_KEY_PASSWORD}
+
 # Artifactory
 artifactoryUsername=${ARTIFACTORY_USER}
 artifactoryPassword=${ARTIFACTORY_PASS}
\ No newline at end of file
-- 
GitLab


From f0fefdd94069435f7297a83bde7cab1f919fb007 Mon Sep 17 00:00:00 2001
From: Michal Neubauer <michal.neubauer@quanti.cz>
Date: Wed, 24 Nov 2021 14:40:27 +0000
Subject: [PATCH 3/3] GIT: VERSION 2.1.0

---
 app/build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/build.gradle b/app/build.gradle
index 587aae9..1091a8b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,7 +16,7 @@ def gitVersionCode = { ->
 
 def VERSION_MAJOR = 2
 def VERSION_MINOR = 1
-def VERSION_PATCH = 1
+def VERSION_PATCH = 0
 
 String APK_NAME = "beneficiary-app"
 String VERSION_NAME = "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
-- 
GitLab