Use debug signingConfig if retro.properties doesn't exist
This commit is contained in:
parent
a85b546e1f
commit
8682b1c09f
2 changed files with 17 additions and 22 deletions
11
.github/workflows/android.yml
vendored
11
.github/workflows/android.yml
vendored
|
@ -19,16 +19,5 @@ jobs:
|
|||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
|
||||
- name: Generate temporary keystore
|
||||
run: keytool -genkey -v -storetype pkcs12 -keystore store.p12 -storepass android -alias android -keyalg RSA -keysize 2048 -validity 10000 -dname CN=CI
|
||||
- name: Write retro.properties
|
||||
run: |
|
||||
cat >retro.properties <<EOF
|
||||
storeFile=$PWD/store.p12
|
||||
keyAlias=android
|
||||
storePassword=android
|
||||
keyPassword=android
|
||||
EOF
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
|
|
@ -20,23 +20,27 @@ android {
|
|||
|
||||
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
Properties properties = getProperties('retro.properties')
|
||||
storeFile file(getProperty(properties, 'storeFile'))
|
||||
keyAlias getProperty(properties, 'keyAlias')
|
||||
storePassword getProperty(properties, 'storePassword')
|
||||
keyPassword getProperty(properties, 'keyPassword')
|
||||
def signingProperties = getProperties('retro.properties')
|
||||
def releaseSigning
|
||||
if (signingProperties != null) {
|
||||
releaseSigning = signingConfigs.create("release") {
|
||||
storeFile file(getProperty(signingProperties, 'storeFile'))
|
||||
keyAlias getProperty(signingProperties, 'keyAlias')
|
||||
storePassword getProperty(signingProperties, 'storePassword')
|
||||
keyPassword getProperty(signingProperties, 'keyPassword')
|
||||
}
|
||||
} else {
|
||||
releaseSigning = signingConfigs.debug
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
shrinkResources true
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
signingConfig releaseSigning
|
||||
}
|
||||
debug {
|
||||
signingConfig releaseSigning
|
||||
applicationIdSuffix '.debug'
|
||||
versionNameSuffix ' DEBUG'
|
||||
}
|
||||
|
@ -51,7 +55,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
buildFeatures{
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
packagingOptions {
|
||||
|
@ -76,16 +80,18 @@ android {
|
|||
}
|
||||
|
||||
def getProperties(String fileName) {
|
||||
final Properties properties = new Properties()
|
||||
Properties properties = new Properties()
|
||||
def file = rootProject.file(fileName)
|
||||
if (file.exists()) {
|
||||
file.withInputStream { stream -> properties.load(stream) }
|
||||
} else {
|
||||
properties = null
|
||||
}
|
||||
return properties
|
||||
}
|
||||
|
||||
static def getProperty(Properties properties, String name) {
|
||||
return properties.getProperty(name) ?: "$name missing"
|
||||
return properties?.getProperty(name) ?: "$name missing"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue