From 90a61748a9a60988992e89f13330f63fe42696af Mon Sep 17 00:00:00 2001 From: kunchok tashi Date: Thu, 18 Jun 2026 12:09:12 -0400 Subject: [PATCH] updated: code magic --- app/build.gradle | 14 ++++++- codemagic.yaml | 104 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 codemagic.yaml diff --git a/app/build.gradle b/app/build.gradle index b9ad347..5f323c4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,11 +10,22 @@ plugins { android { compileSdk 36 namespace = "com.kharagedition.tibetankeyboard" + signingConfigs { + release { + if (System.getenv("CM_KEYSTORE_PATH")) { + storeFile file(System.getenv("CM_KEYSTORE_PATH")) + storePassword System.getenv("CM_KEYSTORE_PASSWORD") + keyAlias System.getenv("CM_KEY_ALIAS") + keyPassword System.getenv("CM_KEY_PASSWORD") + } + } + } defaultConfig { applicationId "com.kharagedition.tibetankeyboard" minSdkVersion 23 targetSdkVersion 36 - versionCode 52 + versionCode project.hasProperty('versionCode') ? project.property('versionCode').toInteger() : 53 + versionName "2.2.10" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -27,6 +38,7 @@ android { buildTypes { release { + signingConfig signingConfigs.release minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' diff --git a/codemagic.yaml b/codemagic.yaml new file mode 100644 index 0000000..e2bee4a --- /dev/null +++ b/codemagic.yaml @@ -0,0 +1,104 @@ +workflows: + + # ── Release workflow ──────────────────────────────────────────────────────── + # Triggers on every push to main. Builds a signed AAB and uploads it to the + # Google Play internal track as a draft for your review before promoting. + android-release: + name: Android Release (AAB → Play Store) + max_build_duration: 90 + instance_type: mac_mini_m2 + + triggering: + events: + - push + branch_patterns: + - pattern: main + include: true + + environment: + # Upload your keystore under Teams → Code signing identities and give + # it the reference name "keystore_reference" (matches the name below). + android_signing: + - keystore_reference + # Create an environment variable group called "google_play" and add + # GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS (the JSON key file content). + groups: + - google_play + vars: + PACKAGE_NAME: "com.kharagedition.tibetankeyboard" + java: 17 + + scripts: + - name: Set Android SDK location + script: | + echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/local.properties" + + - name: Build release AAB + script: | + # Auto-increment version code based on what's already on the Play Store. + LATEST=$(google-play get-latest-build-number --package-name "$PACKAGE_NAME" 2>/dev/null || echo "") + if [ -z "$LATEST" ]; then + VERSION_CODE=$BUILD_NUMBER + else + VERSION_CODE=$(($LATEST + 1)) + fi + echo "Building versionCode=$VERSION_CODE" + ./gradlew bundleRelease -PversionCode=$VERSION_CODE + + artifacts: + - app/build/outputs/**/*.aab + - app/build/outputs/**/mapping.txt + + publishing: + email: + recipients: + - developer.kharag@gmail.com + notify: + success: true + failure: true + google_play: + credentials: $GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS + track: internal + submit_as_draft: true + + # ── Debug / PR workflow ───────────────────────────────────────────────────── + # Runs on every pull request. Builds the debug APK and runs unit tests. + # No signing or publishing needed here. + android-debug: + name: Android Debug (PR checks) + max_build_duration: 60 + instance_type: mac_mini_m2 + + triggering: + events: + - pull_request + branch_patterns: + - pattern: '*' + include: true + + environment: + java: 17 + + scripts: + - name: Set Android SDK location + script: | + echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/local.properties" + + - name: Build debug APK + script: | + ./gradlew assembleDebug + + - name: Run unit tests + script: | + ./gradlew :botok:test :app:testDebugUnitTest + + artifacts: + - app/build/outputs/**/*.apk + + publishing: + email: + recipients: + - developer.kharag@gmail.com + notify: + success: false + failure: true