title: How to get versionName/versionCode from kotlin-dsl Gradle file in Gitlab ci script?
body: <p>How can I get <strong>versionName</strong> and <strong>versionCode</strong> of my android project in Gradle(<strong>Kotlin-DSL</strong>) File from <strong>Gitlab ci script</strong>(gitlab-ci.yaml)?</p>
  
  <p>I have these two commands for getting them from gradle-groovy-dsl, but they don't work on gradle-kotlin-dsl.</p>
  
  <pre><code>- 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}'`
  </code></pre>
  
  <p>sample gradle script in groovy-dsl:</p>
  
  <pre><code>android {
      defaultConfig {
          versionCode 1
          versionName "1.0"
      }
  }
  </code></pre>
  
  <p>sample gradle script in kotlin-dsl:</p>
  
  <pre><code>android {
      defaultConfig {
          versionCode = 1
          versionName = "1.0"
      }
  }
  </code></pre>