Skip to content

Commit d051a61

Browse files
committed
build: configure release pipeline and add flavor dimensions
This commit introduces the following changes: - Configures the release pipeline in the GitHub Actions workflow to set up the keystore, build release artifacts (APKs and AAB), and rename them with version information. - Adds "gms" and "standalone" product flavors to `app/build.gradle.kts`. - Configures signing for release builds using properties from `keystore.properties`. - Specifies different text recognition dependencies for "gms" and "standalone" flavors. - Includes a TODO for a future pipeline to release to Google Play.
1 parent 89eccdd commit d051a61

5 files changed

Lines changed: 78 additions & 58 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Build
22

33
on:
44
push:
@@ -39,4 +39,4 @@ jobs:
3939
run: ./gradlew clean test
4040

4141
- name: Build debug APK (for testing build process)
42-
run: ./gradlew clean build
42+
run: ./gradlew clean assembleDebug

.github/workflows/release.yml

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,10 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build-and-test:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Check out repository
14-
uses: actions/checkout@v4
15-
with:
16-
submodules: true
17-
18-
- name: Set up Java
19-
uses: actions/setup-java@v4
20-
with:
21-
distribution: 'zulu'
22-
java-version: 21
23-
24-
- name: Setup Gradle
25-
uses: gradle/actions/setup-gradle@v4
26-
27-
- name: Cache Gradle packages
28-
uses: actions/cache@v4
29-
with:
30-
path: |
31-
~/.gradle/caches
32-
~/.gradle/wrapper
33-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
34-
restore-keys: |
35-
${{ runner.os }}-gradle-
36-
37-
- name: Run unit tests
38-
run: ./gradlew clean test
39-
40-
- name: Build debug APK (for testing build process)
41-
run: ./gradlew clean build
42-
4310
build-release-apk:
4411
runs-on: ubuntu-latest
45-
needs: build-and-test
12+
env:
13+
APK_DIR: release/
4614
permissions:
4715
contents: write
4816
steps:
@@ -70,6 +38,22 @@ jobs:
7038
restore-keys: |
7139
${{ runner.os }}-gradle-
7240
41+
- name: Setup Keystore
42+
env:
43+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
44+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
45+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
46+
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
47+
run: |
48+
echo "$KEYSTORE_BASE64" | base64 --decode > release.jks
49+
echo "storeFile=release.jks" > keystore.properties
50+
echo "keyAlias=$KEY_ALIAS" >> keystore.properties
51+
echo "keyPassword=$KEY_PASSWORD" >> keystore.properties
52+
echo "storePassword=$STORE_PASSWORD" >> keystore.properties
53+
54+
- name: Build release artifacts
55+
run: ./gradlew clean assembleRelease bundleGmsRelease
56+
7357
- name: Extract version info from tag
7458
id: extract-versions
7559
run: |
@@ -92,15 +76,13 @@ jobs:
9276
echo "Version Name: ${VERSION_NAME}"
9377
echo "Version Code: ${VERSION_CODE}"
9478
95-
9679
- name: Create release folder
97-
run: mkdir -p app/build/outputs/apk/release
80+
run: mkdir -p ${{ env.APK_DIR }}
9881

99-
- name: Build release APK
100-
run: ./gradlew clean assembleRelease
101-
102-
- name: Rename artifact
103-
run: mv "app/build/outputs/apk/release/app-release.apk" "app/build/outputs/apk/release/SummaryExpressive-${{ env.VERSION_NAME }}(${{ env.VERSION_CODE }}).apk"
82+
- name: Rename artifacts
83+
run: |
84+
mv "app/build/outputs/apk/gms/release/app-gms-release.apk" "${{ env.APK_DIR }}/SummaryExpressive-gms-${{ env.VERSION_NAME }}(${{ env.VERSION_CODE }}).apk"
85+
mv "app/build/outputs/apk/standalone/release/app-standalone-release.apk" "${{ env.APK_DIR }}/SummaryExpressive-standalone-${{ env.VERSION_NAME }}(${{ env.VERSION_CODE }}).apk"
10486
10587
- name: Publish GitHub release
10688
uses: softprops/action-gh-release@v2
@@ -109,4 +91,4 @@ jobs:
10991
name: "Release ${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})"
11092
prerelease: false
11193
draft: false
112-
files: app/build/outputs/apk/release/SummaryExpressive-${{ env.VERSION_NAME }}(${{ env.VERSION_CODE }}).apk
94+
files: ${{ env.APK_DIR }}/SummaryExpressive-*.apk

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ local.properties
1616
*.ap_
1717
*.aab
1818
.repo_ignore
19-
.java-version
19+
.java-version
20+
*.jks
21+
keystore.*

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@
2424

2525
---
2626

27-
## Play Store Version (coming soon)
27+
## Download
28+
29+
### Github Release
30+
31+
There are 2 releases available:
32+
33+
- **standalone** which
34+
includes [ML model](https://developers.google.com/ml-kit/vision/text-recognition/v2) to recognize
35+
text from image, it got larger package size.
36+
37+
- **gms** which allows user to download the model from Google Play Services, but GMS required.
38+
39+
### Play Store (coming soon)
2840

2941
<a href='https://play.google.com/store/apps/details?id=me.nanova.SummaryExpressive'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' width='300'/></a>
3042

@@ -48,9 +60,3 @@
4860
dynamic color theme.
4961

5062
It uses OpenAI/Gemini to summarize.
51-
52-
<div align="right">
53-
<table><td>
54-
<a href="#start-of-content">👆 Scroll to top</a>
55-
</td></table>
56-
</div>

app/build.gradle.kts

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import java.util.Properties
2+
import java.io.FileInputStream
3+
14
plugins {
25
id("com.android.application")
36
id("org.jetbrains.kotlin.android")
@@ -9,19 +12,46 @@ plugins {
912
android {
1013
namespace = "me.nanova.summaryexpressive"
1114
compileSdk = 36
15+
flavorDimensions += "distribution"
1216
androidResources {
1317
generateLocaleConfig = true
1418
}
1519
defaultConfig {
1620
applicationId = "me.nanova.summaryexpressive"
1721
minSdk = 33
1822
targetSdk = 36
19-
versionCode = 3
20-
versionName = "0.0.3"
23+
versionCode = 4
24+
versionName = "0.0.4"
2125

2226
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
27+
}
2328

29+
productFlavors {
30+
create("gms") {
31+
dimension = "distribution"
32+
}
33+
create("standalone") {
34+
dimension = "distribution"
35+
applicationIdSuffix = ".standalone"
36+
versionNameSuffix = "-standalone"
37+
}
2438
}
39+
40+
signingConfigs {
41+
val keyPropertiesFile = rootProject.file("keystore.properties")
42+
val keyProperties = Properties()
43+
if (keyPropertiesFile.exists()) {
44+
keyProperties.load(FileInputStream(keyPropertiesFile))
45+
}
46+
47+
create("release") {
48+
keyAlias = keyProperties.getProperty("keyAlias")
49+
keyPassword = keyProperties.getProperty("keyPassword")
50+
storeFile = if (keyProperties.getProperty("storeFile") != null) rootProject.file(keyProperties.getProperty("storeFile")) else null
51+
storePassword = keyProperties.getProperty("storePassword")
52+
}
53+
}
54+
2555
buildTypes {
2656
release {
2757
isMinifyEnabled = true
@@ -30,7 +60,7 @@ android {
3060
getDefaultProguardFile("proguard-android-optimize.txt"),
3161
"proguard-rules.pro"
3262
)
33-
signingConfig = signingConfigs.getByName("debug")
63+
signingConfig = signingConfigs.getByName("release")
3464
}
3565
getByName("debug") {
3666
signingConfig = signingConfigs.getByName("debug")
@@ -84,9 +114,9 @@ dependencies {
84114
implementation("androidx.datastore:datastore-preferences:1.1.7")
85115

86116
// ml & llm
87-
// this will bundle model to apk which is huge, use play service one first
88-
// implementation("com.google.mlkit:text-recognition:16.0.1")
89-
implementation("com.google.android.gms:play-services-mlkit-text-recognition:19.0.1")
117+
// this will bundle model to apk which is huge
118+
"standaloneImplementation"("com.google.mlkit:text-recognition:16.0.1")
119+
"gmsImplementation"("com.google.android.gms:play-services-mlkit-text-recognition:19.0.1")
90120
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.10.2")
91121
implementation("io.ktor:ktor-client-android:3.2.2")
92122
implementation("ai.koog:koog-agents:0.3.0") {

0 commit comments

Comments
 (0)