Skip to content

[WHD-283] CICD: Test github action #31

[WHD-283] CICD: Test github action

[WHD-283] CICD: Test github action #31

name: Firebase App Distribution
on:
push:
branches:
- WHD-283_cicd-try_test_cicd_for_firebase_app_distribution
pull_request:
branches:
- WHD-283_cicd-try_test_cicd_for_firebase_app_distribution
workflow_dispatch:
jobs:
build:
name: Firebase App Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Java 환경 설정
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Flutter 환경 설정
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
channel: 'stable'
- name: AVD(Android Virtual Device) 캐시
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ runner.os }}
- name: 에뮬레이터 생성
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
target: google_apis
arch: x86_64
profile: Nexus 6
script: echo "에뮬레이터 생성 완료"
- name: Key Store 생성
run: echo "${{ secrets.KEY_JKS_BASE64 }}" | base64 --decode > android/app/key.jks
- name: Key Properties 생성
run: echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties
- name: Firebase 및 환경 설정 파일 생성
run: |
# Firebase 설정 파일
echo '${{ secrets.FIREBASE_JSON }}' > firebase.json
echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
# 환경 변수 설정
echo "V1_SERVER_BASE_URL=${{ secrets.V1_SERVER_BASE_URL }}" > .env
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env
echo "FIREBASE_MESSAGING_SENDER_ID=${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}" >> .env
echo "FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}" >> .env
echo "FIREBASE_STORAGE_BUCKET=${{ secrets.FIREBASE_STORAGE_BUCKET }}" >> .env
echo "FIREBASE_ANDROID_APP_KEY=${{ secrets.FIREBASE_ANDROID_APP_KEY }}" >> .env
echo "FIREBASE_ANDROID_APP_ID=${{ secrets.FIREBASE_ANDROID_APP_ID }}" >> .env
echo "FIREBASE_IOS_APP_KEY=${{ secrets.FIREBASE_IOS_APP_KEY }}" >> .env
echo "FIREBASE_IOS_APP_ID=${{ secrets.FIREBASE_IOS_APP_ID }}" >> .env
echo "FIREBASE_ANDROID_CLIENT_ID=${{ secrets.FIREBASE_ANDROID_CLIENT_ID }}" >> .env
echo "FIREBASE_IOS_CLIENT_ID=${{ secrets.FIREBASE_IOS_CLIENT_ID }}" >> .env
echo "FIREBASE_IOS_BUNDLE_ID=${{ secrets.FIREBASE_IOS_BUNDLE_ID }}" >> .env
- name: 설정 파일 확인
run: |
echo "Checking configuration files..."
ls -la firebase.json
ls -la android/app/google-services.json
cat .env | grep -v "KEY\|SECRET\|PASSWORD"
- name: 플러터 클린
run: flutter clean
- name: 의존성 설치
run: flutter pub get
- name: 앱 실행 및 로그 확인
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
target: google_apis
arch: x86_64
profile: Nexus 6
script: |
flutter run --verbose > flutter_run.log 2>&1 || true
echo "===== Flutter Run Log ====="
cat flutter_run.log
echo "=========================="
adb logcat -d > device.log
echo "===== Device Log ====="
cat device.log
echo "====================="
- name: APK 빌드
run: flutter build apk --release --target-platform=android-arm64 --verbose
- name: Firebase App Distribution에 업로드
uses: wzieba/[email protected]
with:
appId: ${{ secrets.FIREBASE_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: team8901
file: build/app/outputs/flutter-apk/app-release.apk