diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4866e5b..6d756fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,8 +10,8 @@ cache: - .gradle stages: + - check - build - - test assembleDebug: interruptible: true @@ -21,15 +21,32 @@ assembleDebug: - ./gradlew assembleDebug artifacts: paths: - - app/build/outputs/ + - app/build/outputs/apk/debug/*.apk -debugTests: +checkApp: interruptible: true - stage: test - needs: [ "assembleDebug" ] + stage: check + needs: [ ] script: - - ./gradlew testDebug + - ./gradlew check artifacts: when: always reports: - junit: ./**/build/test-results/**/TEST-*.xml \ No newline at end of file + junit: ./**/build/test-results/**/TEST-*.xml + +assembleRelease: + interruptible: true + stage: build + needs: [ ] + script: + - echo "$MEALIE_KEY_STORE" | base64 -d > app/mealie-release-key.jks + - echo "keystorePath=mealie-release-key.jks" > keystore.properties + - echo "keystorePassword=$MEALIE_KEY_STORE_PASSWORD" >> keystore.properties + - echo "keyAlias=$MEALIE_KEY_ALIAS" >> keystore.properties + - echo "keyPassword=$MEALIE_KEY_PASSWORD" >> keystore.properties + - ./gradlew assembleRelease + artifacts: + paths: + - app/build/outputs/apk/release/*.apk + rules: + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 92a057e..15b2dc2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,10 +7,6 @@ plugins { id 'org.jetbrains.kotlin.plugin.serialization' } -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - android { compileSdk 31 @@ -24,10 +20,19 @@ android { signingConfigs { release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] + file("../keystore.properties").with { keystorePropertiesFile -> + if (keystorePropertiesFile.canRead()) { + def keystoreProperties = new Properties() + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } else { + println 'Unable to read keystore.properties' + } + } } }