From ce6edf6c2e705b5911fefec83ec749e3c1039c7d Mon Sep 17 00:00:00 2001 From: Mahmoud Elmorabea Date: Thu, 3 Oct 2024 20:21:39 +0300 Subject: [PATCH] chore: Cleanup unused API_KEY from sample apps (#449) --- .github/workflows/build-sample-apps.yml | 5 +---- .github/workflows/snapshot-release.yml | 10 +++++----- samples/sample-app.gradle | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-sample-apps.yml b/.github/workflows/build-sample-apps.yml index 1b822dc9b..195fe0263 100644 --- a/.github/workflows/build-sample-apps.yml +++ b/.github/workflows/build-sample-apps.yml @@ -61,12 +61,10 @@ jobs: - sample-app: "java_layout" cio-cdpapikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY" cio-siteid-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_API_KEY" - sample-app: "kotlin_compose" cio-cdpapikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_CDP_API_KEY" cio-siteid-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_API_KEY" - + runs-on: ubuntu-latest name: Building app...${{ matrix.sample-app }} steps: @@ -90,7 +88,6 @@ jobs: touch "samples/local.properties" echo "cdpApiKey=${{ secrets[matrix.cio-cdpapikey-secret-key] }}" >> "samples/local.properties" echo "siteId=${{ secrets[matrix.cio-siteid-secret-key] }}" >> "samples/local.properties" - echo "apiKey=${{ secrets[matrix.cio-apikey-secret-key] }}" >> "samples/local.properties" - name: Dump GitHub Action metadata because Fastlane uses it. Viewing it here helps debug JSON parsing code in Firebase. run: cat $GITHUB_EVENT_PATH diff --git a/.github/workflows/snapshot-release.yml b/.github/workflows/snapshot-release.yml index 1acef39bc..1e87c00b1 100644 --- a/.github/workflows/snapshot-release.yml +++ b/.github/workflows/snapshot-release.yml @@ -76,25 +76,25 @@ jobs: - sample-app-with-agp: "java_layout_sdk" sample-app: "java_layout" cio-siteid-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_API_KEY" + cio-cdpapikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY" agp-version: "8.3.1" gradle-version: "8.4" - sample-app-with-agp: "kotlin_compose_sdk" sample-app: "kotlin_compose" cio-siteid-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_API_KEY" + cio-cdpapikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_CDP_API_KEY" agp-version: "8.3.1" gradle-version: "8.4" - sample-app-with-agp: "java_layout_7" sample-app: "java_layout" cio-siteid-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_API_KEY" + cio-cdpapikey-secret-key: "CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY" agp-version: "7.4.1" gradle-version: "7.6.4" - sample-app-with-agp: "kotlin_compose_7" sample-app: "kotlin_compose" cio-siteid-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_SITE_ID" - cio-apikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_API_KEY" + cio-cdpapikey-secret-key: "CUSTOMERIO_KOTLIN_WORKSPACE_CDP_API_KEY" agp-version: "7.4.1" gradle-version: "7.6.4" @@ -118,7 +118,7 @@ jobs: touch "samples/local.properties" echo "sdkVersion=${{ needs.publish.outputs.snapshot_version }}" >> "samples/local.properties" echo "siteId=${{ secrets[matrix.cio-siteid-secret-key] }}" >> "samples/local.properties" - echo "apiKey=${{ secrets[matrix.cio-apikey-secret-key] }}" >> "samples/local.properties" + echo "cdpApiKey=${{ secrets[matrix.cio-cdpapikey-secret-key] }}" >> "samples/local.properties" - name: Update files for Gradle compatibility # If AGP version matches the default value, we don't need to specify further versions. diff --git a/samples/sample-app.gradle b/samples/sample-app.gradle index 9f527a705..7f2450454 100644 --- a/samples/sample-app.gradle +++ b/samples/sample-app.gradle @@ -18,12 +18,10 @@ android { // e.g. Java Layout sample app has prefix javaLayout_ for API keys // javaLayout_cdpApiKey=KEY has higher priority than cdpApiKey=KEY // cdpApiKey=KEY can be used as a fallback for all sample apps - String apiKey = getConfigWithPrefix("apiKey") String cdpApiKey = getConfigWithPrefix("cdpApiKey") String siteId = getConfigWithPrefix("siteId") // Set build config fields for API keys - buildConfigField "String", "API_KEY", "\"${apiKey}\"" buildConfigField "String", "CDP_API_KEY", "\"${cdpApiKey}\"" buildConfigField "String", "SITE_ID", "\"${siteId}\"" }