Skip to content

Commit

Permalink
Added APK-version will be red from gradle.build file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Uhrmann committed Feb 18, 2016
1 parent 44c24f4 commit be4b67c
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@ android:
- build-tools-23.0.2
- android-23
before_script:
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
before_install:
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
before_deploy:
# get project version
- export GRADLE_PATH=./app/build.gradle
- export VERSION=$(grep "versionName" $GRADLE_PATH | awk '{print $2}')
- export GIT_TAG=$TRAVIS_BRANCH-$VERSION.$TRAVIS_BUILD_NUMBER
# read project version from gradle.build file
# variables
- export GRADLE_PATH=./app/build.gradle # path to the gradle file
- export GRADLE_FIELD="versionName" # field name
# logic
- export VERSION_TMP=$(grep $GRADLE_FIELD $GRADLE_PATH | awk '{print $2}') # get value versionName"0.1.0"
- export VERSION=$(echo $VERSION_TMP | sed -e 's/^"//' -e 's/"$//') # remove quotes 0.1.0
- export GIT_TAG=$TRAVIS_BRANCH-$VERSION.$TRAVIS_BUILD_NUMBER
# rename APK file
- export OLD_APK=app/build/outputs/apk/app-release-unsigned.apk
- export NEW_APK=app/build/outputs/apk/socko.apk
- mv $OLD_APK $NEW_APK
- export OLD_APK=app/build/outputs/apk/app-release-unsigned.apk
- export NEW_APK=app/build/outputs/apk/socko.apk
- mv $OLD_APK $NEW_APK
# create tagged commit
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push -q https://${GH_TOKEN}@github.com/Vadammt/TravisTest --tags
- ls -aR
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push -q https://${GH_TOKEN}@github.com/Vadammt/TravisTest --tags
- ls -aR
deploy:
provider: releases
api_key:
Expand All @@ -40,7 +44,6 @@ deploy:
skip_cleanup: true
on:
tags: false
# all_branches: true
branch: builds
branches:
except: /^*-v[0-9]/
Expand Down

0 comments on commit be4b67c

Please sign in to comment.