Add build CI

This commit is contained in:
abb128 2023-08-11 23:03:20 +03:00
parent 9e935b05a2
commit 6b42077940
3 changed files with 42 additions and 2 deletions

19
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,19 @@
default:
image: "docker.io/abb128/android-build:latest@sha256:8df16e2badb5e42d2f5e3862683c7ff0ebdcc348affe059385e42eebef79302f"
stages: # List of stages for jobs, and their order of execution
- build
build:
stage: build
tags:
- docker
script:
- ./setUpKeysCI.sh
- gradle assembleRelease -s
- mv build/outputs/apk/release/LatinIME-release.apk ./LatinIME-release-$CI_COMMIT_SHORT_SHA.apk
artifacts:
name: "LatinIME-release-$CI_COMMIT_SHORT_SHA"
paths:
- ./*.apk
when: manual

View File

@ -33,8 +33,6 @@ android {
testApplicationId 'org.futo.inputmethod.latin.tests'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = false
signingConfig signingConfigs.debug
}
signingConfigs {
@ -43,12 +41,29 @@ android {
}
}
final def keystorePropertiesFile = rootProject.file("keystore.properties")
def releaseSigning = signingConfigs.debug
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
releaseSigning = signingConfigs.create("release") {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile rootProject.file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
} else {
project.logger.lifecycle('keystore.properties not found, APK may not be signed')
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.flags'
signingConfig releaseSigning
}
}

6
setUpKeysCI.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
echo ${KEYSTORE_FILE?Need keystore file} | base64 --decode > key.jks
echo storePassword=${KEYSTORE_PASSWORD?Need keystore password} > keystore.properties
echo keyPassword=${KEY_PASSWORD?Need key password} >> keystore.properties
echo keyAlias=${KEYSTORE_ALIAS?Need key alias} >> keystore.properties
echo storeFile=key.jks >> keystore.properties