-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT/#226] Git Action CI/CD 워크플로우를 추가합니다. #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Clody CD | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ staging ] | ||
|
|
||
| jobs: | ||
| cd: | ||
| name: Continuous Deployment | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # Checkout | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Gradle Cache | ||
| - name: Cache Gradle dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| # JDK | ||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| distribution: 'corretto' | ||
| cache: gradle | ||
|
|
||
| # Android SDK | ||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| # gradlew 권한 | ||
| - name: Change gradlew permissions | ||
| run: chmod +x gradlew | ||
|
|
||
| # google-services.json | ||
| - name: Decode google-services.json | ||
| env: | ||
| FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} | ||
| run: echo $FIREBASE_SECRET | base64 --decode > app/google-services.json | ||
|
|
||
| # local.properties | ||
| - name: Generate local.properties | ||
| env: | ||
| BASE_URL: ${{ secrets.BASE_URL }} | ||
| KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }} | ||
| AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }} | ||
| GOOGLE_ADMOB_APP_ID: ${{ secrets.GOOGLE_ADMOB_APP_ID }} | ||
| GOOGLE_ADMOB_UNIT_ID: ${{ secrets.GOOGLE_ADMOB_UNIT_ID }} | ||
| run: | | ||
| echo "baseUrl=$BASE_URL" >> local.properties | ||
| echo "kakao.api.key=$KAKAO_API_KEY" >> local.properties | ||
| echo "amplitude.api.key=$AMPLITUDE_API_KEY" >> local.properties | ||
| echo "googleAdmob.app.id=$GOOGLE_ADMOB_APP_ID" >> local.properties | ||
| echo "googleAdmob.unit.id=$GOOGLE_ADMOB_UNIT_ID" >> local.properties | ||
|
|
||
| # Release AAB 빌드 | ||
| - name: Build Release AAB | ||
| run: ./gradlew bundleRelease --stacktrace | ||
|
|
||
| # Firebase 인증 | ||
| - name: Set up Firebase Service Account Credentials | ||
| env: | ||
| GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }} | ||
| run: | | ||
| echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" | base64 --decode > $HOME/firebase-credentials.json | ||
| export GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase-credentials.json | ||
|
|
||
| # Firebase App Distribution | ||
| - name: Upload AAB to Firebase App Distribution | ||
| env: | ||
| FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | ||
| run: | | ||
| firebase appdistribution:distribute app/build/outputs/bundle/release/app-release.aab \ | ||
| --app "$FIREBASE_APP_ID" \ | ||
| --release-notes "🍀 새로운 테스트 버전이 업로드되었습니다!" \ | ||
| --groups "clody-tester-group" | ||
|
|
||
| # Discord Notification | ||
| - name: Notify Discord | ||
| env: | ||
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
| run: | | ||
| curl -H "Content-Type: application/json" \ | ||
| -X POST \ | ||
| -d '{"content": "🍀 새로운 테스트 버전이 업로드되었습니다!"}' \ | ||
| $DISCORD_WEBHOOK_URL | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| name: Clody CI | ||
|
|
||
| # 언제 동작할지 설정 | ||
| on: | ||
| pull_request: | ||
| branches: [ develop ] | ||
| paths: | ||
| - 'app/**' # app 모듈 내부 변경 | ||
| - 'build.gradle' # 최상위 build.gradle | ||
| - '**/*.kt' # 모든 Kotlin 파일 변경 | ||
|
|
||
| # 공통 작업 디렉토리 설정 | ||
| defaults: | ||
| run: | ||
| working-directory: ./ | ||
|
|
||
| # Job 정의 | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest # Ubuntu 최신 이미지에서 실행 | ||
|
|
||
| steps: | ||
| # Gradle 캐싱 (속도 향상) | ||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties', '**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| # Android SDK 캐싱 | ||
| - name: Cache Android SDK | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.android | ||
| key: ${{ runner.os }}-android | ||
|
|
||
| # GitHub Repo 코드 Checkout | ||
| - name: Checkout the code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # JDK 17 설치 (Android 공식 권장 버전) | ||
| - name: Setup JDK | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'corretto' | ||
| java-version: '17' | ||
|
|
||
| # Android SDK 설치 | ||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| # gradlew 실행 권한 부여 | ||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| # Firebase google-services.json 복호화 및 설정 | ||
| - name: Decode google-services.json | ||
| env: | ||
| FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} # base64로 암호화된 json 사용 | ||
| run: echo $FIREBASE_SECRET | base64 --decode > app/google-services.json | ||
|
|
||
| # local.properties 생성 | ||
| - name: Generate local.properties | ||
| env: | ||
| BASE_URL: ${{ secrets.BASE_URL }} | ||
| KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }} | ||
| AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }} | ||
| GOOGLE_ADMOB_APP_ID: ${{ secrets.GOOGLE_ADMOB_APP_ID }} | ||
| GOOGLE_ADMOB_UNIT_ID: ${{ secrets.GOOGLE_ADMOB_UNIT_ID }} | ||
| run: | | ||
| echo "baseUrl=$BASE_URL" >> local.properties | ||
| echo "kakao.api.key=$KAKAO_API_KEY" >> local.properties | ||
| echo "amplitude.api.key=$AMPLITUDE_API_KEY" >> local.properties | ||
| echo "googleAdmob.app.id=$GOOGLE_ADMOB_APP_ID" >> local.properties | ||
| echo "googleAdmob.unit.id=$GOOGLE_ADMOB_UNIT_ID" >> local.properties | ||
|
|
||
|
|
||
| # ------- Build & Lint ------- | ||
| - name: Run Lint and Build | ||
| run: ./gradlew --no-daemon --configuration-cache ktlintCheck assembleDebug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Firebase Service Account Credentials Setup
The steps on lines 69–76 decode the Firebase service account credentials and set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable.