[Refactor] Hilt 완전 적용 및 멀티 모듈 구조 설정 #43
Workflow file for this run
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
| name: Android Firebase CD | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| cd: | |
| name: Continuous Deployment | |
| runs-on: ubuntu-latest | |
| env: | |
| GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
| LOCAL_PROPERTIES_CONTENTS: ${{ secrets.LOCAL_PROPERTIES_CONTENTS }} | |
| steps: | |
| # 1. Code Checkout | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} # PR이 열릴 때의 브랜치로 체크아웃 | |
| # 2. 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- | |
| # 3. JDK 17 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'corretto' | |
| cache: gradle | |
| # 4. Grant Execute Permission | |
| - name: Change gradlew permissions | |
| run: chmod +x gradlew | |
| # 5. keystore, google-services | |
| - name: Decode And Save Keystore Base64 | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > app/key.jks | |
| - name: Create google-services.json | |
| run: echo "$GOOGLE_SERVICES_JSON" > app/google-services.json | |
| # 6. Install Firebase CLI | |
| - name: Install Firebase CLI | |
| run: curl -sL https://firebase.tools | bash | |
| # Add Local Properties | |
| - name: Add Local Properties | |
| run: | | |
| echo "$LOCAL_PROPERTIES_CONTENTS" > local.properties | |
| echo "SIGNED_STORE_FILE=key.jks" >> local.properties | |
| # 7. Debug Local Properties Check | |
| - name: Debug Local Properties | |
| run: cat local.properties | |
| - name: Extract Version Name | |
| run: echo "##[set-output name=version;]v$(echo '${{ github.event.pull_request.title }}' | grep -oP 'release v\K[0-9]+\.[0-9]+\.[0-9]+')" | |
| id: extract_version | |
| # 8. Release APK Build | |
| - name: Build Release APK | |
| run: ./gradlew assembleRelease --stacktrace | |
| # 9. AAB Artifact Upload | |
| - name: Upload Release AAB | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-aab | |
| path: app/build/outputs/bundle/release/app-release.aab | |
| # 10. APK Artifact Upload | |
| - name: Upload Release APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-apk | |
| path: app/build/outputs/apk/release/app-release.apk | |
| # 11. Firebase App Distribution | |
| - name: Upload to Firebase App Distribution | |
| uses: wzieba/Firebase-Distribution-Github-Action@v1 | |
| with: | |
| appId: ${{secrets.FIREBASE_APP_ID}} | |
| serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} | |
| groups: seungwon | |
| file: app/build/outputs/apk/release/app-release.apk | |
| releaseNotes: "새로운 버전 v${{ steps.extract_version.outputs.version }} 출시" | |
| # 12. Notify Discord | |
| - name: Notify Discord | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| run: | | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{\"content\": \"🚀 새로운 버전 v${{ steps.extract_version.outputs.version }}이 Firebase App Distribution에 업로드되었습니다!\nAPK 다운로드: https://appdistribution.firebase.google.com\"}" \ | |
| $DISCORD_WEBHOOK_URL |