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'
|
java-version: '11'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- uses: gradle/gradle-build-action@v2
|
- 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
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
|
@ -20,23 +20,27 @@ android {
|
||||||
|
|
||||||
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
|
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
|
||||||
}
|
}
|
||||||
signingConfigs {
|
def signingProperties = getProperties('retro.properties')
|
||||||
release {
|
def releaseSigning
|
||||||
Properties properties = getProperties('retro.properties')
|
if (signingProperties != null) {
|
||||||
storeFile file(getProperty(properties, 'storeFile'))
|
releaseSigning = signingConfigs.create("release") {
|
||||||
keyAlias getProperty(properties, 'keyAlias')
|
storeFile file(getProperty(signingProperties, 'storeFile'))
|
||||||
storePassword getProperty(properties, 'storePassword')
|
keyAlias getProperty(signingProperties, 'keyAlias')
|
||||||
keyPassword getProperty(properties, 'keyPassword')
|
storePassword getProperty(signingProperties, 'storePassword')
|
||||||
|
keyPassword getProperty(signingProperties, 'keyPassword')
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
releaseSigning = signingConfigs.debug
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
shrinkResources true
|
shrinkResources true
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig releaseSigning
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
|
signingConfig releaseSigning
|
||||||
applicationIdSuffix '.debug'
|
applicationIdSuffix '.debug'
|
||||||
versionNameSuffix ' DEBUG'
|
versionNameSuffix ' DEBUG'
|
||||||
}
|
}
|
||||||
|
@ -51,7 +55,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures{
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
|
@ -76,16 +80,18 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
def getProperties(String fileName) {
|
def getProperties(String fileName) {
|
||||||
final Properties properties = new Properties()
|
Properties properties = new Properties()
|
||||||
def file = rootProject.file(fileName)
|
def file = rootProject.file(fileName)
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.withInputStream { stream -> properties.load(stream) }
|
file.withInputStream { stream -> properties.load(stream) }
|
||||||
|
} else {
|
||||||
|
properties = null
|
||||||
}
|
}
|
||||||
return properties
|
return properties
|
||||||
}
|
}
|
||||||
|
|
||||||
static def getProperty(Properties properties, String name) {
|
static def getProperty(Properties properties, String name) {
|
||||||
return properties.getProperty(name) ?: "$name missing"
|
return properties?.getProperty(name) ?: "$name missing"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue