Fix debug build if no key

This commit is contained in:
soraefir 2024-04-07 11:10:10 +02:00
parent 71acf04f20
commit 3fe83cff2e
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
2 changed files with 22 additions and 10 deletions

View File

@ -48,7 +48,7 @@ jobs:
cache: 'gradle' cache: 'gradle'
- name: Build APK - name: Build APK
run: ./gradlew assemble run: ./gradlew assembleSignedRelease
# - name: Upload APK # - name: Upload APK
# uses: actions/upload-artifact@v4 # uses: actions/upload-artifact@v4
@ -61,4 +61,4 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
files: | files: |
app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/signedRelease/app-release.apk

View File

@ -5,9 +5,6 @@ plugins {
id 'com.mikepenz.aboutlibraries.plugin' version '11.1.1' id 'com.mikepenz.aboutlibraries.plugin' version '11.1.1'
} }
def keystorePropertiesFile = rootProject.file("app/keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
namespace 'net.helcel.beans' namespace 'net.helcel.beans'
@ -20,22 +17,37 @@ android {
versionCode 1 versionCode 1
versionName "0.1a" versionName "0.1a"
} }
signingConfigs { signingConfigs {
create("release") { create("release") {
keyAlias keystoreProperties['keyAlias'] try {
keyPassword keystoreProperties['keyPassword'] def keystorePropertiesFile = rootProject.file("app/keystore.properties")
storeFile file(keystoreProperties['storeFile']) def keystoreProperties = new Properties()
storePassword keystoreProperties['storePassword'] keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
} catch (FileNotFoundException e) {
println("File not found: ${e.message}")
}
} }
} }
buildTypes { buildTypes {
debug {
debuggable true
}
release { release {
minifyEnabled true minifyEnabled true
shrinkResources false shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
signedRelease {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig = signingConfigs.getByName("release") signingConfig = signingConfigs.getByName("release")
} }
} }