Skip to content

Commit b162b97

Browse files
committed
Add release signing config
Reads keystore credentials from a gitignored key.properties so release builds are signed consistently instead of debug-signed, which lets future releases install as updates over old ones.
1 parent 92e9e28 commit b162b97

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

app/build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ plugins {
33
id 'kotlin-android'
44
}
55

6+
def keystoreProperties = new Properties()
7+
def keystorePropertiesFile = rootProject.file('key.properties')
8+
if (keystorePropertiesFile.exists()) {
9+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
10+
}
11+
612
android {
713
namespace 'com.sleepbutton.app'
814
compileSdk 34
@@ -15,11 +21,23 @@ android {
1521
versionName "1.0"
1622
}
1723

24+
signingConfigs {
25+
release {
26+
if (keystorePropertiesFile.exists()) {
27+
storeFile file(keystoreProperties['storeFile'])
28+
storePassword keystoreProperties['storePassword']
29+
keyAlias keystoreProperties['keyAlias']
30+
keyPassword keystoreProperties['keyPassword']
31+
}
32+
}
33+
}
34+
1835
buildTypes {
1936
release {
2037
minifyEnabled true
2138
shrinkResources true
2239
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
40+
signingConfig signingConfigs.release
2341
}
2442
}
2543

0 commit comments

Comments
 (0)