title: Auto increment versioncode only on releases
body: <p>Currently I'm trying to improve our buildscript with auto incrementing the versioncode so our QA team has got a clue what build they are testing and can log against a specific versioncode. We have got 3 productFlavors (staging, qa, production) and 2  signing configs (debug, release).</p>
  
  <p>I looked into different solutions:</p>
  
  <p><a href="https://stackoverflow.com/questions/17448565/how-to-autoincrement-versioncode-in-android-gradle/26091797">How to autoincrement versionCode in Android Gradle</a></p>
  
  <p><a href="https://stackoverflow.com/questions/17448565/how-to-autoincrement-versioncode-in-android-gradle/17525195">How to autoincrement versionCode in Android Gradle</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21405457/autoincrement-versioncode-with-gradle-extra-properties/28043555">Autoincrement VersionCode with gradle extra properties</a></p>
  
  <p>Based on those answers I've built a versioncode incrementor using a version.properties file.</p>
  
  <p>Now the problem arises that for EVERY productFlavor and SigningConfig combination (+ the gradle sync in android studio) a new versioncode is generated. I want the versioncode to increment whenever I hit the play button to create a qaRelease build. So our buildcycle would be:</p>
  
  <ul>
  <li>development (never change the versioncode)</li>
  <li>qual (Update the versioncode)</li>
  <li>production (never change the versioncode)</li>
  </ul>