How can I get versionName and versionCode of my android project in Gradle(Kotlin-DSL) File from Gitlab ci script(gitlab-ci.yaml)?
I have these two commands for getting them from gradle-groovy-dsl, but they don't work on gradle-kotlin-dsl.
- export VERSION_NAME=`egrep '^[[:blank:]]+versionName[[:blank:]]' app/build.gradle | awk '{print $2}' | sed s/\"//g`
- export VERSION_CODE=`egrep '^[[:blank:]]+versionCode[[:blank:]]' app/build.gradle | awk '{print $2}'`
sample gradle script in groovy-dsl:
android {
defaultConfig {
versionCode 1
versionName "1.0"
}
}
sample gradle script in kotlin-dsl:
android {
defaultConfig {
versionCode = 1
versionName = "1.0"
}
}