Skip to content
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

[#491] Enhance CICD workflow for releasing production to Firebase App Distribution #554

Closed
wants to merge 2 commits into from
Closed
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,68 @@
name: Deploy production to Firebase App Distribution

on:
# Trigger the workflow on push action in main branch.
# So it will trigger when the PR of the feature branch was merged.
push:
branches:
- main

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

Comment on lines +22 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure deploy workflow does not need to Set up timezone step 🙏 Same for staging workflow

- name: Checkout source code
uses: actions/checkout@v4

- name: Cache Gradle
uses: actions/cache@v2
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@v3
with:
name: DetektReports
path: build/reports/detekt/

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

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

Comment on lines +41 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we don't need these code analyzing & testing steps on CD workflows. Let's save our billing resources 🙏 Same for staging workflow

- name: Build production APK
run: ./gradlew assembleProductionRelease
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set up keystore?


- 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/debug/app-production-release.apk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file: app/build/outputs/apk/production/debug/app-production-release.apk
file: app/build/outputs/apk/production/release/app-production-release.apk

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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.
Expand All @@ -8,8 +8,8 @@ on:
- develop

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 Down Expand Up @@ -66,14 +66,3 @@ jobs:
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: app/build/outputs/apk/staging/debug/app-staging-debug.apk

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

- 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/debug/app-production-debug.apk
Loading