|
| 1 | +name: Firebase App Distribution |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + build_type: |
| 7 | + description: '배포할 빌드 타입' |
| 8 | + required: true |
| 9 | + default: 'debug' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - debug |
| 13 | + - release |
| 14 | + release_notes: |
| 15 | + description: '릴리스 노트 (비워두면 최신 커밋 메시지 사용)' |
| 16 | + required: false |
| 17 | + default: '' |
| 18 | + testers: |
| 19 | + description: '테스터 이메일 (쉼표 구분, 예: a@example.com,b@example.com)' |
| 20 | + required: false |
| 21 | + default: '' |
| 22 | + groups: |
| 23 | + description: 'Firebase Console 테스터 그룹 별칭 (쉼표 구분, 예: qa-team,beta-testers)' |
| 24 | + required: false |
| 25 | + default: '' |
| 26 | + |
| 27 | +jobs: |
| 28 | + distribute: |
| 29 | + name: Build & Distribute (${{ github.event.inputs.build_type }}) |
| 30 | + runs-on: ubuntu-latest |
| 31 | + concurrency: |
| 32 | + group: distribute-${{ github.event.inputs.build_type }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Set up JDK 17 |
| 40 | + uses: actions/setup-java@v4 |
| 41 | + with: |
| 42 | + distribution: temurin |
| 43 | + java-version: '17' |
| 44 | + |
| 45 | + - name: Configure Gradle |
| 46 | + uses: gradle/actions/setup-gradle@v3 |
| 47 | + |
| 48 | + - name: Create local.properties |
| 49 | + run: | |
| 50 | + echo "signed.store.file=keystore.jks" >> local.properties |
| 51 | + echo "signed.store.password=${{ secrets.SIGNED_STORE_PASSWORD }}" >> local.properties |
| 52 | + echo "signed.key.alias=${{ secrets.SIGNED_KEY_ALIAS }}" >> local.properties |
| 53 | + echo "signed.key.password=${{ secrets.SIGNED_KEY_PASSWORD }}" >> local.properties |
| 54 | + echo "debug.base.url=${{ secrets.DEBUG_BASE_URL }}" >> local.properties |
| 55 | + echo "release.base.url=${{ secrets.RELEASE_BASE_URL }}" >> local.properties |
| 56 | +
|
| 57 | + - name: Decode Keystore |
| 58 | + run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks |
| 59 | + |
| 60 | + - name: Decode Firebase Service Account |
| 61 | + run: echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}" | base64 --decode > app/firebase-service-account.json |
| 62 | + |
| 63 | + - name: Resolve release notes |
| 64 | + id: notes |
| 65 | + run: | |
| 66 | + NOTE="${{ github.event.inputs.release_notes }}" |
| 67 | + if [ -z "$NOTE" ]; then |
| 68 | + NOTE="$(git log -1 --format='%s (%h)')" |
| 69 | + fi |
| 70 | + { |
| 71 | + echo "value<<EOF" |
| 72 | + echo "$NOTE" |
| 73 | + echo "EOF" |
| 74 | + } >> $GITHUB_OUTPUT |
| 75 | +
|
| 76 | + - name: Resolve distribution arguments |
| 77 | + id: dist_args |
| 78 | + run: | |
| 79 | + ARGS="" |
| 80 | + TESTERS="${{ github.event.inputs.testers }}" |
| 81 | + GROUPS="${{ github.event.inputs.groups }}" |
| 82 | + if [ -n "$TESTERS" ]; then |
| 83 | + ARGS="$ARGS -PfirebaseAppDistributionTesters=$TESTERS" |
| 84 | + fi |
| 85 | + if [ -n "$GROUPS" ]; then |
| 86 | + ARGS="$ARGS -PfirebaseAppDistributionGroups=$GROUPS" |
| 87 | + fi |
| 88 | + echo "args=$ARGS" >> $GITHUB_OUTPUT |
| 89 | +
|
| 90 | + - name: Distribute (Debug) |
| 91 | + if: github.event.inputs.build_type == 'debug' |
| 92 | + run: | |
| 93 | + ./gradlew appDistributionUploadDebug \ |
| 94 | + "-PfirebaseAppDistributionReleaseNotes=${{ steps.notes.outputs.value }}" \ |
| 95 | + ${{ steps.dist_args.outputs.args }} |
| 96 | + env: |
| 97 | + GOOGLE_APPLICATION_CREDENTIALS: app/firebase-service-account.json |
| 98 | + |
| 99 | + - name: Distribute (Release) |
| 100 | + if: github.event.inputs.build_type == 'release' |
| 101 | + run: | |
| 102 | + ./gradlew appDistributionUploadRelease \ |
| 103 | + "-PfirebaseAppDistributionReleaseNotes=${{ steps.notes.outputs.value }}" \ |
| 104 | + ${{ steps.dist_args.outputs.args }} |
| 105 | + env: |
| 106 | + GOOGLE_APPLICATION_CREDENTIALS: app/firebase-service-account.json |
0 commit comments