diff --git a/.gitlab-ci-files/job-android.yml b/.gitlab-ci-files/job-android.yml index 92ebb1a91..8d0346585 100644 --- a/.gitlab-ci-files/job-android.yml +++ b/.gitlab-ci-files/job-android.yml @@ -8,15 +8,21 @@ job-android: - if ! [ -z ${SCP_PRIVATE_KEY+x} ]; then eval $(ssh-agent -s); fi - if ! [ -z ${SCP_PRIVATE_KEY+x} ]; then echo "$SCP_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null; fi - if ! [ -z ${ANDROID_SETTINGS_GRADLE+x} ]; then echo "$ANDROID_SETTINGS_GRADLE" > settings.gradle.kts; fi - - git config --global --add safe.directory /builds/BC/private/linphone-android-6.0 + - git config --global --add safe.directory /builds/BC/private/linphone-android script: + - scp -oStrictHostKeyChecking=no $DEPLOY_SERVER:$ANDROID_KEYSTORE_PATH app/ + - scp -oStrictHostKeyChecking=no $DEPLOY_SERVER:$ANDROID_GOOGLE_SERVICES_PATH app/ + - echo storePassword=$ANDROID_KEYSTORE_PASSWORD > keystore.properties + - echo keyPassword=$ANDROID_KEYSTORE_KEY_PASSWORD >> keystore.properties + - echo keyAlias=$ANDROID_KEYSTORE_KEY_ALIAS >> keystore.properties + - echo storeFile=$ANDROID_KEYSTORE_FILE >> keystore.properties - ./gradlew app:dependencies | grep org.linphone - ./gradlew assembleDebug artifacts: paths: - - ./app/build/outputs/apk/debug/linphone-android-debug-6.0.0.apk + - ./app/build/outputs/apk/debug/linphone-android-debug-*.apk when: always expire_in: 1 week @@ -24,4 +30,4 @@ job-android: .scheduled-job-android: extends: job-android only: - - schedules + - schedules \ No newline at end of file diff --git a/.gitlab-ci-files/job-upload.yml b/.gitlab-ci-files/job-upload.yml new file mode 100644 index 000000000..31e1d1a50 --- /dev/null +++ b/.gitlab-ci-files/job-upload.yml @@ -0,0 +1,12 @@ +job-android-upload: + + stage: deploy + tags: [ "deploy" ] + + only: + - schedules + dependencies: + - job-android + + script: + - cd app/build/outputs/apk/ && rsync ./debug/*.apk $DEPLOY_SERVER:$ANDROID_DEPLOY_DIRECTORY \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6cca8eb26..a127bb8f7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,8 @@ import com.android.build.gradle.internal.tasks.factory.dependsOn import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension import java.io.ByteArrayOutputStream +import java.io.FileInputStream +import java.util.Properties plugins { alias(libs.plugins.androidApplication) @@ -107,6 +109,19 @@ android { } } + val keystorePropertiesFile = rootProject.file("keystore.properties") + val keystoreProperties = Properties() + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + + signingConfigs { + create("release") { + storeFile = File(keystoreProperties["storeFile"].toString()) + storePassword = keystoreProperties["storePassword"].toString() + keyAlias = keystoreProperties["keyAlias"].toString() + keyPassword = keystoreProperties["keyPassword"].toString() + } + } + buildTypes { getByName("debug") { if (useDifferentPackageNameForDebugBuild) { diff --git a/keystore.properties b/keystore.properties new file mode 100644 index 000000000..3612cabbb --- /dev/null +++ b/keystore.properties @@ -0,0 +1,4 @@ +storePassword= +keyPassword= +keyAlias= +storeFile=bc-android.keystore \ No newline at end of file