Skip to content

Commit 163fe0e

Browse files
author
Titouan Thibaud
committed
First attempt to create the release pipeline on GitHub actions
1 parent 87c69b1 commit 163fe0e

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/android_ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- name: Run ktlint
2828
run: ./gradlew ktlintCheck
2929

30+
# TODO: Detekt rules are not fully respected on this code right now.
3031
# - name: Run detekt
3132
# run: ./gradlew detekt
3233

.github/workflows/release_apk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Grant execute permission for gradlew
3030
run: chmod +x gradlew
3131

32-
- name: Run unit tests
33-
run: ./gradlew testDebugUnitTest
32+
# - name: Run unit tests
33+
# run: ./gradlew testDebugUnitTest
3434

3535
- name: Build Release APK
3636
env:

app/build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,32 @@ android {
2121
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2222
}
2323

24+
signingConfigs {
25+
create("release") {
26+
val keystoreFile = System.getenv("KEYSTORE_FILE")
27+
val keystorePassword = System.getenv("KEYSTORE_PASSWORD")
28+
val keyAlias = System.getenv("KEY_ALIAS")
29+
val keyPassword = System.getenv("KEY_PASSWORD")
30+
31+
if (keystoreFile != null && keystorePassword != null && keyAlias != null && keyPassword != null) {
32+
this.storeFile = file(keystoreFile)
33+
this.storePassword = keystorePassword
34+
this.keyAlias = keyAlias
35+
this.keyPassword = keyPassword
36+
} else if (System.getenv("GITHUB_ACTIONS") == "true") {
37+
throw GradleException("Missing one or more release signing environment variables. Please set KEYSTORE_FILE, KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD.")
38+
}
39+
}
40+
}
41+
2442
buildTypes {
2543
release {
2644
isMinifyEnabled = false
2745
proguardFiles(
2846
getDefaultProguardFile("proguard-android-optimize.txt"),
2947
"proguard-rules.pro",
3048
)
49+
signingConfig = signingConfigs.getByName("release")
3150
}
3251
}
3352

0 commit comments

Comments
 (0)