1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-06-24 21:25:23 +00:00

Fixed CI/CD.

This commit is contained in:
Koen 2023-06-20 13:16:45 +02:00
parent 9880a5810d
commit c4491d195b
3 changed files with 21 additions and 14 deletions

View file

@ -1,13 +1,19 @@
stages:
- buildAndDeployApk
- buildAndDeployApk
variables:
ANDROID_VERSION_NAME:
value: ""
description: "Enter the version name here (e.g. 1.0.1)."
ANDROID_VERSION_CODE:
value: ""
description: "Enter the version code here (e.g. 1)."
buildAndDeployApk:
stage: buildAndDeployApk
script:
- ./gradlew --stacktrace assembleRelease
- if [ -z "$ANDROID_VERSION_NAME" ] || [ -z "$ANDROID_VERSION_CODE" ]; then echo "Version name or code not specified. Skipping build."; exit 0; fi
- ./receivers/android/gradlew --stacktrace assembleRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE
- cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fcast-release.apk
- git describe --tags > /var/www/html/fcast-version.txt
only:
- tags
except:
- branches
- cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fastcast-release.apk
when: manual

View file

@ -2,16 +2,15 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.10'
id 'org.ajoberstar.grgit' version '1.7.2'
}
ext {
gitVersionName = grgit.describe()
gitVersionCode = gitVersionName != null && gitVersionName.isInteger() ? gitVersionName.toInteger() : 1
currentVersionName = project.hasProperty('versionName') ? project.property('versionName') : '1.0.0'
currentVersionCode = project.hasProperty('versionCode') ? Integer.parseInt(project.property('versionCode')) : 1
}
println("Version Name: $gitVersionName")
println("Version Code: $gitVersionCode")
println("Version Name: $currentVersionName")
println("Version Code: $currentVersionCode")
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('/opt/key.properties')
@ -27,8 +26,8 @@ android {
applicationId "com.futo.fcast.receiver"
minSdk 24
targetSdk 33
versionCode gitVersionCode
versionName gitVersionName
versionCode currentVersionCode
versionName currentVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}