Skip to content

Commit

Permalink
adjusted CI so releases are only build on new Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mx0c committed Dec 4, 2020
1 parent 805cb03 commit 8b3ab3a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
46 changes: 25 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,35 @@ android:
- build-tools-29.0.3
- android-29
- extra-android-m2repository
script:
- "./gradlew clean :app:assembleRelease"
before_install:
- chmod +x gradlew
install:
- echo y | sdkmanager "ndk;21.0.6113669"
- echo y | sdkmanager "cmake;3.6.4111459"
before_deploy:
- export APP_VERSION=$(./gradlew :app:printVersionName)
deploy:
provider: releases
api_key:
secure: $GITHUB_TOKEN
file: $TRAVIS_BUILD_DIR/app/build/outputs/apk/release/app*release*.apk
file_glob: true
name: "$APP_VERSION"
tag_name: "$APP_VERSION"
overwrite: true
skip_cleanup: true
on:
repo: mx0c/Android-BLE-Monitor
branch: master
jobs:
include:
- # Build debug
if: branch IN (develop, master)
script: "./gradlew :app:assembleDebug"
- # Only if Tag is present
if: tag IS present
script: "git fetch --tags && ./gradlew clean :app:assembleRelease"
deploy:
provider: releases
edge: true
api_key: $API_KEY
file: $TRAVIS_BUILD_DIR/app/build/outputs/apk/release/*.apk
skip_cleanup: true
file_glob: true
draft: false
on:
tags: true
name: $TRAVIS_TAG
tag_name: $TRAVIS_TAG
release_notes: "Generated release from Travis CI for build $TRAVIS_BUILD_NUMBER"
cache:
directories:
- "$HOME/.m2"
- "$HOME/.gradle"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
- "$HOME/.m2"
- "$HOME/.gradle"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
14 changes: 6 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
apply plugin: 'com.android.application'

task printVersionName {
doLast {
println android.defaultConfig.versionName
}
plugins {
id 'de.nanogiants.android-versioning' version '2.4.0'
}
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
Expand All @@ -14,8 +11,8 @@ android {
applicationId "com.huc.android_ble_monitor"
minSdkVersion 21
targetSdkVersion 29
versionCode 3
versionName "1.0.2"
versionCode versioning.getVersionCode()
versionName versioning.getVersionName()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { moduleName "hciviewer" }
}
Expand Down Expand Up @@ -84,4 +81,5 @@ dependencies {

// rv-adapter-states
implementation 'com.rockerhieu:rv-adapter-states:1.2'

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void onCreate() {
public void scanForDevices(boolean enable){
Log.i(TAG, "BLE Scan for devices: " + (enable ? "activated" : "deactivated"));
if(enable) {
ScanSettings scanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_POWER).build();
ScanSettings scanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
List<ScanFilter> filters = new ArrayList<ScanFilter>();
BleUtil.mBleScanner.startScan(filters, scanSettings, new ScanCallback() {
@Override
Expand Down
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'

classpath 'com.android.tools.build:gradle:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 16 20:39:12 CET 2020
#Fri Dec 04 00:36:32 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

0 comments on commit 8b3ab3a

Please sign in to comment.