From 0f76e634dd5d508595f963e84bdda89f257403bf Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Fri, 12 Aug 2022 17:07:04 +0300 Subject: [PATCH] DROID-301 CI | Enhancement | Enable debug channel analytics for debug nightly builds (#2506) --- .github/workflows/nightly-debug-builds.yml | 5 ++++- .gitignore | 1 + Makefile | 3 +++ analytics/build.gradle | 14 +++++++++++++- analytics/gradle.properties | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 analytics/gradle.properties diff --git a/.github/workflows/nightly-debug-builds.yml b/.github/workflows/nightly-debug-builds.yml index abb3edfc06..97b544c02b 100644 --- a/.github/workflows/nightly-debug-builds.yml +++ b/.github/workflows/nightly-debug-builds.yml @@ -16,9 +16,12 @@ jobs: amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }} run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug - - name: Enable dated version for night distribution build + - name: Enable dated version for nightly debug builds run: make enable_dated_version_name + - name: Enable analytics for nightly debug builds + run: make enable_analytics_for_debug + - name: Decrypt secrets run: ./scripts/distribution/decrypt-secrets.sh env: diff --git a/.gitignore b/.gitignore index c372ff2c9e..15dde8e3d2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /apikeys.properties /scripts/release/app-release.jks /scripts/distribution/anytype-debug-service-account-key.json +/analytics/gradle.properties .DS_Store **/build /libs diff --git a/Makefile b/Makefile index 78aec380f4..740f11629e 100644 --- a/Makefile +++ b/Makefile @@ -10,5 +10,8 @@ enable_dated_version_name: distribute_debug: ./gradlew bundleDebug appDistributionUploadDebug +enable_analytics_for_debug: + ./gradlew :analytics:enableAnalyticsForDebugBuilds + pr_check: compile_android_test_sources test_debug_all diff --git a/analytics/build.gradle b/analytics/build.gradle index 03a4ac13af..54822a0e65 100644 --- a/analytics/build.gradle +++ b/analytics/build.gradle @@ -20,7 +20,7 @@ android { buildConfigField "boolean", "SEND_EVENTS", "true" } debug { - buildConfigField "boolean", "SEND_EVENTS", "false" + buildConfigField "boolean", "SEND_EVENTS", getProperty('config.enableAnalyticsForDebugBuilds') } } @@ -42,3 +42,15 @@ dependencies { implementation app.timber implementation analytics.amplitude } + +tasks.register("enableAnalyticsForDebugBuilds") { + doLast { + enableAnalyticsForDebugBuilds() + } +} + +def enableAnalyticsForDebugBuilds() { + def file = file('gradle.properties') + def content = "config.enableAnalyticsForDebugBuilds=true" + file.text = content.toString() +} \ No newline at end of file diff --git a/analytics/gradle.properties b/analytics/gradle.properties new file mode 100644 index 0000000000..9b96d4829f --- /dev/null +++ b/analytics/gradle.properties @@ -0,0 +1 @@ +config.enableAnalyticsForDebugBuilds=false \ No newline at end of file