From 880c8b914580ed55d77d13073598fecec272ba49 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Wed, 3 Apr 2024 06:27:10 +0530 Subject: [PATCH] chore: adding release apk (#9) * chore: adding release apk * chore: update github actions * chore: update keystore name Co-authored-by: Kartik Shah * chore: linux eol --------- Co-authored-by: Kartik Shah --- .github/workflows/check-code.yml | 2 +- .gitignore | 1 + app/build.gradle.kts | 10 ++++++++++ ci/pipeline.yml | 10 ++++++++++ ci/tasks/build.sh | 2 ++ ci/tasks/upload-to-gcs.sh | 2 +- ci/values.yml | 2 ++ 7 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index ea96ef2..00761c1 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -25,4 +25,4 @@ jobs: run: ./gradlew lint - name: Build with Gradle - run: ./gradlew build + run: ./gradlew assembleDebug diff --git a/.gitignore b/.gitignore index aa724b7..a681374 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ .externalNativeBuild .cxx local.properties +app/pos-keystore diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d702342..de44d0a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,9 +16,19 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + create("release") { + keyAlias = "key0" + storeFile = file("pos-keystore") + keyPassword = "android" + storePassword = "android" + } + } + buildTypes { release { isMinifyEnabled = false + signingConfig = signingConfigs.getByName("release") proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" diff --git a/ci/pipeline.yml b/ci/pipeline.yml index ded1e22..3e314cb 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -65,6 +65,12 @@ resources: bucket: #@ data.values.build_artifacts_bucket_name json_key: #@ data.values.build_artifacts_bucket_creds regexp: pos-print-companion/dev/android/pos-print-companion-(.+)-v.+/apk/debug/app-debug.apk + - name: built-release-apk + type: gcs-resource + source: + bucket: #@ data.values.build_artifacts_bucket_name + json_key: #@ data.values.build_artifacts_bucket_creds + regexp: pos-print-companion/dev/android/pos-print-companion-(.+)-v.+/apk/release/app-release.apk - name: version type: semver source: @@ -135,6 +141,8 @@ jobs: - name: artifacts run: path: pipeline-tasks/ci/tasks/build.sh + params: + keystore: #@ data.values.keystore - task: upload-to-gcs config: @@ -161,6 +169,7 @@ jobs: - get: pipeline-tasks - get: version - get: built-dev-apk + - get: built-release-apk - task: prep-release config: platform: linux @@ -182,6 +191,7 @@ jobs: body: artifacts/gh-release-notes.md globs: - built-dev-apk/app-debug.apk + - built-release-apk/app-release.apk - put: version params: file: version/version diff --git a/ci/tasks/build.sh b/ci/tasks/build.sh index 18f1239..9707558 100755 --- a/ci/tasks/build.sh +++ b/ci/tasks/build.sh @@ -2,6 +2,8 @@ set -eu +echo "$keystore" | base64 --decode > repo/app/pos-keystore + current_dir=$(pwd) cd repo/ ./gradlew build diff --git a/ci/tasks/upload-to-gcs.sh b/ci/tasks/upload-to-gcs.sh index 8fbe1e6..81bffa3 100755 --- a/ci/tasks/upload-to-gcs.sh +++ b/ci/tasks/upload-to-gcs.sh @@ -12,4 +12,4 @@ gcloud auth activate-service-account --key-file key.json pushd artifacts -gsutil cp -r app/build/outputs/apk/debug/* gs://$bucket/pos-print-companion/$GCS_DIRECTORY/android/pos-print-companion-$(date +%s)-v${version}/apk/debug/ +gsutil cp -r app/build/outputs/apk/* gs://$bucket/pos-print-companion/$GCS_DIRECTORY/android/pos-print-companion-$(date +%s)-v${version}/apk/ diff --git a/ci/values.yml b/ci/values.yml index 844cf13..4094018 100644 --- a/ci/values.yml +++ b/ci/values.yml @@ -17,3 +17,5 @@ gh_repository: pos-print-companion build_artifacts_bucket_name: galoy-build-artifacts build_artifacts_bucket_creds: ((build-artifacts-bucket-creds.creds_json)) + +keystore: ((pos-companion-keystore.keystore))