diff --git a/.github/workflows/app-distribution-ci-cd.yaml b/.github/workflows/app-distribution-ci-cd.yaml new file mode 100644 index 00000000..e2d38dd5 --- /dev/null +++ b/.github/workflows/app-distribution-ci-cd.yaml @@ -0,0 +1,80 @@ +name: Build & upload to Firebase App Distribution + +on: + push: + branches: [ dev ] + workflow_dispatch: # 수동 실행 옵션 (생략가능) + +jobs: + build: + runs-on: ubuntu-latest + + env: + LOCAL_PROPERTIES_CONTENTS: ${{ secrets.LOCAL_PROPERTIES_CONTENTS }} + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + + steps: + - uses: actions/checkout@v1 + + - name: set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: grant permission for gradlew + run: chmod +x ./gradlew + shell: bash + + - name: Create local.properties + run: echo "$LOCAL_PROPERTIES_CONTENTS" > local.properties + + - name: Create google-services.json + run: echo "$GOOGLE_SERVICES_JSON" > app/google-services.json + + - name: build release + run: ./gradlew assembleDebug + + - name: upload artifact to Firebase App Distribution + uses: wzieba/Firebase-Distribution-Github-Action@v1 + with: + appId: ${{secrets.FIREBASE_APP_ID}} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + groups: winey-team + # file: app/build/outputs/apk/release/app-release-unsigned.apk + file: app/build/outputs/apk/debug/app-debug.apk + +# steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# - name: Setup JDK 11 +# uses: actions/setup-java@v3 +# with: +# distribution: "zulu" +# java-version: 11 +# +# - name: Setup Android SDK +# uses: android-actions/setup-android@v2 +# +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# +# - name: Decrypt secrets.tar.gpg +# run: gpg --quiet --batch --yes --always-trust --decrypt --passphrase="$SECRET_GPG_PASSWORD" --output secrets.tar secrets.tar.gpg +# env: +# SECRET_GPG_PASSWORD: ${{ secrets.SECRET_GPG_PASSWORD }} +# +# - name: Unzip secrets.tar +# run: tar xvf secrets.tar +# +# - name: Build release universal apk +# run: ./gradlew presentation:packageReleaseUniversalApk +# +# - name: Upload apk to Firebase App Distribution +# uses: wzieba/Firebase-Distribution-Github-Action@v1 +# with: +# appId: ${{ secrets.FIREBASE_APP_ID }} +# token: ${{ secrets.FIREBASE_TOKEN }} +# groups: runnerbe +# file: presentation/build/outputs/universal_apk/release/presentation-release-universal.apk +# releaseNotesFile: documents/release-note/default-note.txt \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ab847a0d..bb322ebd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id(DAGGER_HILT_ANDROID) id(KOTLIN_KAPT) } + id("com.google.gms.google-services") } val properties = Properties().apply { @@ -91,7 +92,9 @@ dependencies { implementation(project(":feature:mypage")) implementation("com.kakao.sdk:v2-user:2.15.0") // 카카오 로그인 implementation("com.google.android.gms:play-services-auth:20.6.0") - + implementation(platform("com.google.firebase:firebase-bom:32.6.0")) + implementation("com.google.firebase:firebase-analytics") + with(Dependency) { implementation(ANDROID_CORE_KTX) implementation(APPCOMPAT) diff --git a/build.gradle.kts b/build.gradle.kts index 323ac4f7..4205202c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ buildscript { dependencies { classpath(Dependency.HILT_ANDROID_GRADLE_PLUGIN) classpath(Dependency.KOTLIN_GRADLE_PLUGIN) + classpath("com.android.tools.build:gradle:8.0.2") } } // 모든 하위 프로젝트/모듈에 공통적인 구성 옵션을 추가하는 최상위 빌드 @@ -12,4 +13,5 @@ plugins { id(JETBRAINS_KOTLIN_ANDROID) version Versions.KOTLIN apply false id(DAGGER_HILT_PLUGIN) version Versions.HILT apply false } + id("com.google.gms.google-services") version "4.4.0" apply false } \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts index d252a3e5..ec5ff985 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -62,7 +62,7 @@ dependencies { implementation(CONVERTER_GSON) implementation(OKHTTP) implementation(LOGGING_INTERCEPTOR) - debugImplementation(CHUCKER_LIBRARY) + implementation(CHUCKER_LIBRARY) testImplementation(JUNIT) } } \ No newline at end of file diff --git a/feature/auth/build.gradle.kts b/feature/auth/build.gradle.kts index 86fbc556..ef146125 100644 --- a/feature/auth/build.gradle.kts +++ b/feature/auth/build.gradle.kts @@ -32,6 +32,16 @@ android { "GOOGLE_OAUTH_CLIENT_SECRET", properties["google.oauth.client.secret"] as String ) + buildConfigField( + "String", + "DEBUG_ACCESSTOKEN", + properties["debug.access.token"] as String + ) + buildConfigField( + "String", + "DEBUG_REFRESHTOKEN", + properties["debug.refresh.token"] as String + ) } buildTypes { diff --git a/feature/auth/src/main/java/com/teamwiney/auth/login/LoginScreen.kt b/feature/auth/src/main/java/com/teamwiney/auth/login/LoginScreen.kt index f6b60320..a4d6f076 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/login/LoginScreen.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/login/LoginScreen.kt @@ -74,10 +74,10 @@ fun LoginScreen( effectFlow.collectLatest { effect -> when (effect) { is LoginContract.Effect.NavigateTo -> { - if(effect.destination==HomeDestinations.ROUTE){ + if (effect.destination == HomeDestinations.ROUTE) { onInit() } - appState.navigate(effect.destination,effect.navOptions) + appState.navigate(effect.destination, effect.navOptions) } is LoginContract.Effect.ShowSnackBar -> { @@ -140,15 +140,19 @@ fun LoginScreen( } // 홈화면 테스트용 아이콘 SocialLoginButton(drawable = R.mipmap.img_lock) { - onInit() - appState.navigate(HomeDestinations.ROUTE) { - popUpTo(AuthDestinations.Login.ROUTE) { - inclusive = true + appState.showSnackbar("홈 화면 테스트 입니다.") + viewModel.testLogin { + onInit() + appState.navigate(HomeDestinations.ROUTE) { + popUpTo(AuthDestinations.Login.ROUTE) { + inclusive = true + } } } } // 회원가입 테스트용 아이콘 SocialLoginButton(drawable = R.mipmap.img_winey_logo_title) { + appState.showSnackbar("회원가입 화면 테스트 입니다.") appState.navigate("${AuthDestinations.SignUp.ROUTE}?userId=15") } } diff --git a/feature/auth/src/main/java/com/teamwiney/auth/login/LoginViewModel.kt b/feature/auth/src/main/java/com/teamwiney/auth/login/LoginViewModel.kt index cdd80600..4f003aec 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/login/LoginViewModel.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/login/LoginViewModel.kt @@ -14,6 +14,7 @@ import com.teamwiney.core.common.navigation.HomeDestinations import com.teamwiney.core.common.util.Constants.ACCESS_TOKEN import com.teamwiney.core.common.util.Constants.LOGIN_TYPE import com.teamwiney.core.common.util.Constants.REFRESH_TOKEN +import com.teamwiney.feature.auth.BuildConfig import com.teamwiney.data.network.adapter.ApiResult import com.teamwiney.data.network.model.response.SocialLogin import com.teamwiney.data.network.service.SocialType @@ -25,6 +26,7 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext import javax.inject.Inject @HiltViewModel @@ -112,6 +114,14 @@ class LoginViewModel @Inject constructor( is ApiResult.Success -> { val userStatus = result.data.result.userStatus if (userStatus == SocialLogin.USER_STATUS_ACTIVE) { + Log.i( + "[ACCESS_TOKEN]", + "accessToken: ${result.data.result.accessToken}" + ) + Log.i( + "[REFRESH_TOKEN]", + "refreshToken: ${result.data.result.refreshToken}" + ) dataStoreRepository.setStringValue( ACCESS_TOKEN, result.data.result.accessToken @@ -122,6 +132,7 @@ class LoginViewModel @Inject constructor( ) dataStoreRepository.setStringValue(LOGIN_TYPE, socialType.name) + postEffect(LoginContract.Effect.NavigateTo( destination = HomeDestinations.ROUTE, navOptions = navOptions { @@ -146,4 +157,22 @@ class LoginViewModel @Inject constructor( } } } + + fun testLogin(callback: () -> Unit) = viewModelScope.launch { + val accessToken = BuildConfig.DEBUG_ACCESSTOKEN + val refreshToken = BuildConfig.DEBUG_REFRESHTOKEN + + withContext(coroutineContext) { + dataStoreRepository.setStringValue( + ACCESS_TOKEN, + accessToken + ) + dataStoreRepository.setStringValue( + REFRESH_TOKEN, + refreshToken + ) + } + callback() + } + } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be5d4ddf..9aa42cd7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jul 10 17:33:03 KST 2023 +#Mon Dec 04 01:21:47 KST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists