Skip to content

Instantly share code, notes, and snippets.

@alabeduarte
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alabeduarte/bcda31f1f8fdf68002d7 to your computer and use it in GitHub Desktop.
Save alabeduarte/bcda31f1f8fdf68002d7 to your computer and use it in GitHub Desktop.
Versioning android app with maven based on the latest git tag
#!/bin/bash -exu
TAG_COUNT=$(git tag | wc -l | grep -o '[0-9]\+')
CURRENT_TAG=$(git describe --abbrev=0 --tags | grep -o '[0-9\.]\+')
mvn versions:set -DnewVersion=$CURRENT_TAG -DgenerateBackupPoms=false
mvn clean package -Prelease -Dproject.version=$CURRENT_TAG -Dproject.versionCode=$TAG_COUNT -Dsign.keystore=$KEY_STORE_PATH -Dsign.alias=${PROJECT_NAME} -Dsign.storepass= -Dsign.keypass=${PROJECT_PASSWORD}
jarsigner -verbose -verify -certs app/target/app-signed-aligned.apk > jarsigner.verify.certs.verbose.output.txt
echo $(aapt dump badging app/target/app.apk | grep version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment