Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Deploy production to Firebase App Distribution

on:
push:
branches:
- main
workflow_dispatch:
inputs:
testerGroups:
description: "Tester groups (Use \"vars.TESTER_GROUPS\" as default)"
required: false
type: string

jobs:
deploy_production_to_firebase_app_distribution:
name: Deploy production to Firebase App Distribution
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set up timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Bangkok

- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Run Detekt
run: ./gradlew detekt

- name: Archive Detekt reports
uses: actions/upload-artifact@v4
with:
name: DetektReports
path: build/reports/detekt/

- name: Run unit tests with Kover
run: ./gradlew koverHtmlReportCustom

- name: Archive code coverage reports
uses: actions/upload-artifact@v4
with:
name: CodeCoverageReports
path: app/build/reports/kover/

- name: Generate release notes
id: generate-release-notes
run: |
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_OUTPUT
echo "$(git log --merges --pretty=%B $(git describe --abbrev=0 --tags)..HEAD | grep "\[")" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

- name: Build production APK
run: ./gradlew assembleProductionPreRelease

- name: Deploy production to Firebase
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.FIREBASE_APP_ID_PRODUCTION}}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIAL_FILE_CONTENT }}
groups: ${{ github.event.inputs.testerGroups || vars.TESTER_GROUPS }}
file: app/build/outputs/apk/production/preRelease/app-production-preRelease.apk
releaseNotes: ${{ steps.generate-release-notes.outputs.RELEASE_NOTES }}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
name: Deploy staging and production to Firebase App Distribution
name: Deploy staging to Firebase App Distribution

on:
# Trigger the workflow on push action in develop branch.
# So it will trigger when the PR of the feature branch was merged.
push:
branches:
- develop
workflow_dispatch:
inputs:
testerGroups:
description: "Tester groups (Use \"vars.TESTER_GROUPS\" as default)"
required: false
type: string

jobs:
deploy_staging_and_production_to_firebase_app_distribution:
name: Deploy staging and production to Firebase App Distribution
deploy_staging_to_firebase_app_distribution:
name: Deploy staging to Firebase App Distribution
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -26,6 +32,8 @@ jobs:

- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Gradle
uses: actions/cache@v4
Expand Down Expand Up @@ -59,21 +67,18 @@ jobs:
- name: Build staging APK
run: ./gradlew assembleStagingPreRelease

- name: Generate release notes
id: generate-release-notes
run: |
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_OUTPUT
echo "$((git log -1 --merges | grep "\[") | grep . && echo "" || echo $(git log -1 --merges --format=%B))" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

- name: Deploy staging to Firebase
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.FIREBASE_APP_ID_STAGING}}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIAL_FILE_CONTENT }}
groups: testers
groups: ${{ github.event.inputs.testerGroups || vars.TESTER_GROUPS }}
file: app/build/outputs/apk/staging/preRelease/app-staging-preRelease.apk

- name: Build production APK
run: ./gradlew assembleProductionPreRelease

- name: Deploy production to Firebase
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.FIREBASE_APP_ID_PRODUCTION}}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: app/build/outputs/apk/production/preRelease/app-production-preRelease.apk
releaseNotes: ${{ steps.generate-release-notes.outputs.RELEASE_NOTES }}
Loading