Skip to content

Commit

Permalink
update flavors and credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurcugnierecs committed Sep 24, 2024
1 parent 64e2313 commit 9900b5c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
- name: Build with Gradle
run: ./gradlew build
env:
PROD_SAMPLE_PROJECT_ID: ${{ secrets.PROD_SAMPLE_PROJECT_ID }}
PROD_MAPPING_UPLOAD_CLIENT_ID: ${{ secrets.PROD_MAPPING_UPLOAD_CLIENT_ID }}
PROD_MAPPING_UPLOAD_CLIENT_SECRET: ${{ secrets.PROD_MAPPING_UPLOAD_CLIENT_SECRET }}

# Optional Step: Run your tests
- name: Run tests
run: ./gradlew test
35 changes: 19 additions & 16 deletions CSSampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ plugins {

android {
compileSdk 35
def csProjectId = 5671
defaultConfig {
applicationId "com.example.androidsampleapp"
minSdk 21
Expand All @@ -25,23 +24,17 @@ android {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// Set credentials from different source, fallback on Github CI --> see android-ci.yml
def localProperties = getLocalProperties()
errorAnalysisCrash {
uploadCredentials {
projectId = csProjectId
clientId = System.getenv("PROD_MAPPING_UPLOAD_CLIENT_ID") ?: ""
clientSecret = System.getenv("PROD_MAPPING_UPLOAD_CLIENT_SECRET") ?: ""
}
}
}

minify {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
errorAnalysisCrash {
uploadCredentials {
projectId = csProjectId
clientId = System.getenv("PROD_MAPPING_UPLOAD_CLIENT_ID") ?: ""
// from gradle.properties
projectId = project.findProperty("PROD_SAMPLE_PROJECT_ID")?.toInteger() ?:
System.getenv("PROD_SAMPLE_PROJECT_ID")
// from local.properties
clientId = localProperties.getProperty("PROD_MAPPING_UPLOAD_CLIENT_ID", "") ?:
System.getenv("PROD_MAPPING_UPLOAD_CLIENT_ID")
// from environment variable, is the same than Github CI here
clientSecret = System.getenv("PROD_MAPPING_UPLOAD_CLIENT_SECRET") ?: ""
}
}
Expand Down Expand Up @@ -98,3 +91,13 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

def getLocalProperties() {
def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localProperties.load(new FileInputStream(localPropertiesFile))
return localProperties
}
return null
}

0 comments on commit 9900b5c

Please sign in to comment.