Skip to content

Commit

Permalink
Add firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
z-huang committed Aug 3, 2023
1 parent aa3e71e commit cfc868b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Decode google-services.json
run: echo ${{ secrets.GOOGLE_SERVICES }} | base64 -d >> app/google-services.json

- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileName: 'Key/music-debug.jks'
encodedString: ${{ secrets.KEYSTORE }}
run: echo ${{ secrets.KEYSTORE }} | base64 -d >> app/music-debug.jks

- name: set up JDK 11
uses: actions/setup-java@v3
Expand All @@ -35,9 +34,8 @@ jobs:
- name: Build debug APK and run jvm tests
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
env:
MUSIC_DEBUG_KEYSTORE_FILE: 'Key/music-debug.jks'
MUSIC_DEBUG_KEYSTORE_FILE: 'music-debug.jks'
MUSIC_DEBUG_SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
MUSIC_DEBUG_SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
MUSIC_DEBUG_SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}

- name: Upload APK
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

- name: Build debug APK and run jvm tests
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
env:
PULL_REQUEST: 'true'

- name: Upload APK
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ captures/
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json
google-services.json

# Freeline
freeline.py
Expand Down
13 changes: 8 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ plugins {
kotlin("kapt")
id("com.google.dagger.hilt.android")
id("com.google.devtools.ksp")
if (System.getenv("PULL_REQUEST") == null) {
id("com.google.gms.google-services")
}
}

android {
Expand Down Expand Up @@ -35,12 +38,9 @@ android {
signingConfigs {
getByName("debug") {
if (System.getenv("MUSIC_DEBUG_SIGNING_STORE_PASSWORD") != null) {
val tmpFilePath = System.getProperty("user.home") + "/work/_temp/Key/"
val allFilesFromDir = File(tmpFilePath).listFiles()
val keystoreFile = allFilesFromDir?.first()
storeFile = keystoreFile ?: file(System.getenv("MUSIC_DEBUG_KEYSTORE_FILE"))
storeFile = file(System.getenv("MUSIC_DEBUG_KEYSTORE_FILE"))
storePassword = System.getenv("MUSIC_DEBUG_SIGNING_STORE_PASSWORD")
keyAlias = System.getenv("MUSIC_DEBUG_SIGNING_KEY_ALIAS")
keyAlias = "debug"
keyPassword = System.getenv("MUSIC_DEBUG_SIGNING_KEY_PASSWORD")
}
}
Expand Down Expand Up @@ -124,5 +124,8 @@ dependencies {

coreLibraryDesugaring(libs.desugaring)

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)

implementation(libs.timber)
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {
dependencies {
classpath(libs.gradle)
classpath(kotlin("gradle-plugin", libs.versions.kotlin.get()))
classpath(libs.google.services)
}
}

Expand Down
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
androidGradlePlugin = "7.4.2"
googleServices = "4.3.15"
kotlin = "1.8.0"
compose-compiler = "1.4.0"
compose = "1.3.3"
Expand Down Expand Up @@ -74,5 +75,9 @@ junit = { group = "junit", name = "junit", version = "4.13.2" }

timber = { group = "com.jakewharton.timber", name = "timber", version = "4.7.1" }

google-services = { module = "com.google.gms:google-services", version.ref = "googleServices" }
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version = "32.2.0" }
firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx" }

[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

0 comments on commit cfc868b

Please sign in to comment.