From 3e41de88c3d63b95299f314cebd4ba9e73f167e2 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 13:56:31 +0530 Subject: [PATCH 01/14] Create Staging.yml --- .github/workflows/Staging.yml | 137 ++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 .github/workflows/Staging.yml diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml new file mode 100644 index 000000000..6a0090541 --- /dev/null +++ b/.github/workflows/Staging.yml @@ -0,0 +1,137 @@ +name: Staging CI + +on: + pull_request: + branches: [ "surya-test" ] + + workflow_dispatch: + inputs: + run_unit_tests: + description: 'Run Unit Tests' + required: true + type: boolean + default: true + branch: + description: 'Branch to build' + required: true + default: 'develop' + publish_to_firebase: + description: 'Publish to Firebase App Distribution' + required: true + type: boolean + default: false + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - name: Print Runner Info + run: | + echo "Runner Name: ${{ runner.name }}" + echo "Runner OS: ${{ runner.os }}" + echo "Runner Type: ${{ runner.arch }}" + + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch || github.ref }} + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Create google-services.json + env: + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + run: | + mkdir -p app + echo $GOOGLE_SERVICES_JSON | base64 -di > app/google-services.json + + - name: Create Secret.kt file + env: + SECRET_FILE: ${{ secrets.SECRET_FILE }} + run: | + mkdir -p app + echo $SECRET_FILE | base64 -di > buildSrc/src/main/java/Secure.kt + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run Unit Tests + if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + run: | + APP_SELECTION="${{ github.event.inputs.app_selection }}" + EVENT_NAME="${{ github.event_name }}" + mkdir -p output + ./gradlew testGetSmarterStagingUnitTest + + - name: Upload Unit Test Report + if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + uses: actions/upload-artifact@v4 + with: + name: unit-test-report + path: | + app/build/test-results + app/build/reports/tests + + - name: Summarize Unit Test Results + if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + run: | + echo "### Unit Test Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Test Results:**" >> $GITHUB_STEP_SUMMARY + grep -r "> $GITHUB_STEP_SUMMARY + + - name: Build Selected App(s) and zip apk output + run: | + APP_SELECTION="${{ github.event.inputs.app_selection }}" + EVENT_NAME="${{ github.event_name }}" + mkdir -p output + + ./gradlew assembleGetSmarterStaging + cp app/build/outputs/apk/getSmarter/staging/app-getSmarter-staging.apk output/ + + zip -r app-staging-${{ github.run_number }}.zip output/ + + - name: Upload APK ZIP + uses: actions/upload-artifact@v4 + with: + name: app-staging-${{ github.run_number }} + path: app-staging-${{ github.run_number }}.zip + + - name: Install Firebase CLI + if: ${{ github.event.inputs.publish_to_firebase == 'true' }} + run: npm install -g firebase-tools + + - name: Authenticate Firebase CLI + if: ${{ github.event.inputs.publish_to_firebase == 'true' }} + run: | + echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}" | base64 -d > firebase-key.json + firebase login:ci --token "$(cat firebase-key.json)" + + - name: Publish to Firebase App Distribution + if: ${{ github.event.inputs.publish_to_firebase == 'true' }} + run: | + if [[ "${{ github.event.inputs.app_selection }}" == "getsmarter" || "${{ github.event.inputs.app_selection }}" == "both" ]]; then + firebase appdistribution:distribute output/app-getSmarter-staging.apk \ + --app ${{ secrets.FIREBASE_APP_ID_GETSMARTER }} \ + --release-notes "Automated build from GitHub Actions" + fi + + if [[ "${{ github.event.inputs.app_selection }}" == "campus" || "${{ github.event.inputs.app_selection }}" == "both" ]]; then + firebase appdistribution:distribute output/app-campus-staging.apk \ + --app ${{ secrets.FIREBASE_APP_ID_CAMPUS }} \ + --release-notes "Automated build from GitHub Actions" + fi + + + - name: Cleanup sensitive files and directories + run: | + echo "Cleaning up sensitive files..." + rm -rf app + rm -rf buildSrc From a5c18523d8c69e1a53daf0c6751e5dcc044afe9b Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 14:31:26 +0530 Subject: [PATCH 02/14] Update Staging.yml --- .github/workflows/Staging.yml | 82 +++++++++++++++-------------------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 6a0090541..1239442db 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -48,61 +48,61 @@ jobs: env: GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} run: | - mkdir -p app - echo $GOOGLE_SERVICES_JSON | base64 -di > app/google-services.json + sh ./open_source.sh + echo $GOOGLE_SERVICES_JSON | base64 -di > apps/student/google-services.json - name: Create Secret.kt file env: SECRET_FILE: ${{ secrets.SECRET_FILE }} run: | mkdir -p app - echo $SECRET_FILE | base64 -di > buildSrc/src/main/java/Secure.kt + echo $SECRET_FILE | base64 -di > apps/buildSrc/src/main/java/Secure.kt - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Run Unit Tests - if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - run: | - APP_SELECTION="${{ github.event.inputs.app_selection }}" - EVENT_NAME="${{ github.event_name }}" - mkdir -p output - ./gradlew testGetSmarterStagingUnitTest - - - name: Upload Unit Test Report - if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - uses: actions/upload-artifact@v4 - with: - name: unit-test-report - path: | - app/build/test-results - app/build/reports/tests - - - name: Summarize Unit Test Results - if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - run: | - echo "### Unit Test Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**Test Results:**" >> $GITHUB_STEP_SUMMARY - grep -r "> $GITHUB_STEP_SUMMARY + # - name: Run Unit Tests + # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + # run: | + # APP_SELECTION="${{ github.event.inputs.app_selection }}" + # EVENT_NAME="${{ github.event_name }}" + # mkdir -p output + # cd apps + # ./gradlew :student:testTwouDebugUnitTest + + # - name: Upload Unit Test Report + # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + # uses: actions/upload-artifact@v4 + # with: + # name: unit-test-report + # path: | + # app/build/test-results + # app/build/reports/tests + + # - name: Summarize Unit Test Results + # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} + # run: | + # echo "### Unit Test Summary" >> $GITHUB_STEP_SUMMARY + # echo "" >> $GITHUB_STEP_SUMMARY + # echo "**Test Results:**" >> $GITHUB_STEP_SUMMARY + # grep -r "> $GITHUB_STEP_SUMMARY - name: Build Selected App(s) and zip apk output run: | - APP_SELECTION="${{ github.event.inputs.app_selection }}" EVENT_NAME="${{ github.event_name }}" mkdir -p output - ./gradlew assembleGetSmarterStaging - cp app/build/outputs/apk/getSmarter/staging/app-getSmarter-staging.apk output/ - + cd apps + ./gradlew :student:assembleTwouDebug + cp apps/student/build/outputs/apk/twou/debug/student-twou-debug.apk output/ zip -r app-staging-${{ github.run_number }}.zip output/ - name: Upload APK ZIP uses: actions/upload-artifact@v4 with: name: app-staging-${{ github.run_number }} - path: app-staging-${{ github.run_number }}.zip + path: apps/app-staging-${{ github.run_number }}.zip - name: Install Firebase CLI if: ${{ github.event.inputs.publish_to_firebase == 'true' }} @@ -117,21 +117,11 @@ jobs: - name: Publish to Firebase App Distribution if: ${{ github.event.inputs.publish_to_firebase == 'true' }} run: | - if [[ "${{ github.event.inputs.app_selection }}" == "getsmarter" || "${{ github.event.inputs.app_selection }}" == "both" ]]; then - firebase appdistribution:distribute output/app-getSmarter-staging.apk \ - --app ${{ secrets.FIREBASE_APP_ID_GETSMARTER }} \ + firebase appdistribution:distribute apps/output/student-twou-debug.apk \ + --app ${{ secrets.FIREBASE_APP_ID_DEGREES }} \ --release-notes "Automated build from GitHub Actions" - fi - - if [[ "${{ github.event.inputs.app_selection }}" == "campus" || "${{ github.event.inputs.app_selection }}" == "both" ]]; then - firebase appdistribution:distribute output/app-campus-staging.apk \ - --app ${{ secrets.FIREBASE_APP_ID_CAMPUS }} \ - --release-notes "Automated build from GitHub Actions" - fi - - name: Cleanup sensitive files and directories run: | echo "Cleaning up sensitive files..." - rm -rf app - rm -rf buildSrc + rm -rf apps From 337997deabbcc11f02bd21d9423f00bfa2d271bb Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 14:33:14 +0530 Subject: [PATCH 03/14] Update Staging.yml --- .github/workflows/Staging.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 1239442db..421fb95a7 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -59,7 +59,9 @@ jobs: echo $SECRET_FILE | base64 -di > apps/buildSrc/src/main/java/Secure.kt - name: Grant execute permission for gradlew - run: chmod +x gradlew + run: | + cd apps + chmod +x gradlew # - name: Run Unit Tests # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} From 0b60bf1e15387d28e46797e0a927237bb28f8a2c Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 14:43:58 +0530 Subject: [PATCH 04/14] added changes to checkout submodule --- .github/workflows/Staging.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 421fb95a7..8054cd5ca 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -35,6 +35,8 @@ jobs: - uses: actions/checkout@v4 with: + submodules: true # This initializes and updates submodules + fetch-depth: 0 # Optional: fetch full history if needed ref: ${{ github.event.inputs.branch || github.ref }} - name: Set up JDK 17 From 90964b04d857fea9ed00be76b8e079a36d5d7bc7 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 14:53:28 +0530 Subject: [PATCH 05/14] updated submodule checkout --- .github/workflows/Staging.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 8054cd5ca..ad5b6fdca 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -35,9 +35,12 @@ jobs: - uses: actions/checkout@v4 with: - submodules: true # This initializes and updates submodules - fetch-depth: 0 # Optional: fetch full history if needed ref: ${{ github.event.inputs.branch || github.ref }} + + - name: Checkout specific submodule + run: | + git submodule init apps/mobile-offline-downloader-android + git submodule update apps/mobile-offline-downloader-android - name: Set up JDK 17 uses: actions/setup-java@v4 From fbdfb3edf113ed549267e954cdc4b6f21a6ff944 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 14:58:29 +0530 Subject: [PATCH 06/14] Update .gitmodules --- .gitmodules | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index be7f7de0e..06b7c3fb6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "android-vault"] - path = android-vault - url = git@github.com:instructure/android-vault.git [submodule "apps/mobile-offline-downloader-android"] path = apps/mobile-offline-downloader-android - url = git@github.com:2uinc/mobile-offline-downloader-android.git + url = https://github.com/2uinc/mobile-offline-downloader-android.git From 76e59fec6e77345b1ff3a50dcf6aad9cdd86cd8b Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 15:06:09 +0530 Subject: [PATCH 07/14] Update Staging.yml --- .github/workflows/Staging.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index ad5b6fdca..7676a9663 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -40,7 +40,10 @@ jobs: - name: Checkout specific submodule run: | git submodule init apps/mobile-offline-downloader-android - git submodule update apps/mobile-offline-downloader-android + git submodule update apps/mobile-offline-downloader-android + cd apps/mobile-offline-downloader-android + git checkout surya-test + - name: Set up JDK 17 uses: actions/setup-java@v4 From 444e39db22ac50177cc6a1b6899778ebc1899bcd Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 15:20:12 +0530 Subject: [PATCH 08/14] Update code setup step --- .github/workflows/Staging.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 7676a9663..0b078eb76 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -52,11 +52,14 @@ jobs: distribution: 'temurin' cache: gradle + - name: Setup Code + run: sh ./open_source.sh + - name: Create google-services.json env: GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} run: | - sh ./open_source.sh + pwd echo $GOOGLE_SERVICES_JSON | base64 -di > apps/student/google-services.json - name: Create Secret.kt file From 5d67200939ebee0d645fe7c96d55899a05b8d8d3 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 22:22:25 +0530 Subject: [PATCH 09/14] reordered googleservices step --- .github/workflows/Staging.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 0b078eb76..f59efffa7 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -52,15 +52,15 @@ jobs: distribution: 'temurin' cache: gradle - - name: Setup Code - run: sh ./open_source.sh - - name: Create google-services.json env: GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} run: | pwd - echo $GOOGLE_SERVICES_JSON | base64 -di > apps/student/google-services.json + echo $GOOGLE_SERVICES_JSON | base64 -di > open_source_data/student/google-services.json + + - name: Setup Code + run: sh ./open_source.sh - name: Create Secret.kt file env: From cecad64356649266719a6e9c5b96c8b17cb4b5bf Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 22:51:12 +0530 Subject: [PATCH 10/14] Update Staging.yml --- .github/workflows/Staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index f59efffa7..e8f7f2da8 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -108,7 +108,7 @@ jobs: cd apps ./gradlew :student:assembleTwouDebug - cp apps/student/build/outputs/apk/twou/debug/student-twou-debug.apk output/ + cp student/build/outputs/apk/twou/debug/student-twou-debug.apk output/ zip -r app-staging-${{ github.run_number }}.zip output/ - name: Upload APK ZIP From 3a68e430d31b474ddbdff541cd3a07fe9244707d Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Mon, 8 Sep 2025 23:08:57 +0530 Subject: [PATCH 11/14] Updated output folder --- .github/workflows/Staging.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index e8f7f2da8..6924a59d6 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -104,10 +104,11 @@ jobs: - name: Build Selected App(s) and zip apk output run: | EVENT_NAME="${{ github.event_name }}" - mkdir -p output cd apps ./gradlew :student:assembleTwouDebug + + mkdir -p output cp student/build/outputs/apk/twou/debug/student-twou-debug.apk output/ zip -r app-staging-${{ github.run_number }}.zip output/ From 0d8a0c47387d094217518855f49e70ee7fa44407 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Fri, 10 Oct 2025 17:54:56 +0530 Subject: [PATCH 12/14] Update Staging.yml --- .github/workflows/Staging.yml | 87 ++++++++++++++++++++++++----------- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 6924a59d6..40f36dcc3 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -26,6 +26,14 @@ jobs: runs-on: ubuntu-latest steps: + + - name: Show Action Info and Set App Selection + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "Pull Request triggered from ${{ github.head_ref }} to ${{ github.base_ref }} " + else + echo "Manual Workflow trigger from ${{ github.actor }} for ${{ github.event.inputs.branch }} branch " + fi - name: Print Runner Info run: | @@ -44,7 +52,6 @@ jobs: cd apps/mobile-offline-downloader-android git checkout surya-test - - name: Set up JDK 17 uses: actions/setup-java@v4 with: @@ -74,32 +81,30 @@ jobs: cd apps chmod +x gradlew - # - name: Run Unit Tests - # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - # run: | - # APP_SELECTION="${{ github.event.inputs.app_selection }}" - # EVENT_NAME="${{ github.event_name }}" - # mkdir -p output - # cd apps - # ./gradlew :student:testTwouDebugUnitTest - - # - name: Upload Unit Test Report - # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - # uses: actions/upload-artifact@v4 - # with: - # name: unit-test-report - # path: | - # app/build/test-results - # app/build/reports/tests - - # - name: Summarize Unit Test Results - # if: ${{ github.event_name == 'pull_request' || github.event.inputs.run_unit_tests == 'true' }} - # run: | - # echo "### Unit Test Summary" >> $GITHUB_STEP_SUMMARY - # echo "" >> $GITHUB_STEP_SUMMARY - # echo "**Test Results:**" >> $GITHUB_STEP_SUMMARY - # grep -r "> $GITHUB_STEP_SUMMARY + - name: Run Unit Tests + if: ${{ github.event.inputs.run_unit_tests == 'true' }} + run: | + mkdir -p output + cd apps + ./gradlew :student:testTwouDebugUnitTest + + - name: Upload Unit Test Report + if: ${{ github.event.inputs.run_unit_tests == 'true' }} + uses: actions/upload-artifact@v4 + with: + name: unit-test-report + path: | + app/build/test-results + app/build/reports/tests + + - name: Summarize Unit Test Results + if: ${{ github.event.inputs.run_unit_tests == 'true' }} + run: | + echo "### Unit Test Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Test Results:**" >> $GITHUB_STEP_SUMMARY + grep -r "> $GITHUB_STEP_SUMMARY - name: Build Selected App(s) and zip apk output run: | @@ -139,3 +144,31 @@ jobs: run: | echo "Cleaning up sensitive files..." rm -rf apps + + - name: Authenticate Firebase CLI + # if: ${{ github.event.inputs.publish_to_firebase == 'true' }} + run: | + echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}" | base64 -d > firebase-key.json + + - name: Distribute Degrees App via Firebase App Distribution + # if: ${{ github.event.inputs.publish_to_firebase == 'true' && (env.APP_SELECTION == 'getsmarter' || env.APP_SELECTION == 'both')}} + uses: gowthamraj281/firebase-app-distribution@v1 + with: + # The release binary file to upload. + file: apps/student/build/outputs/apk/twou/debug/student-twou-debug.apk + # Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page. + app: ${{ secrets.FIREBASE_APP_ID_DEGREES }} + # Path to the Google service account credentials file + credentials-file: firebase-key.json + # Release notes for this build. + release-notes: "Run link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + # The tester groups you want to invite (refer to Manage testers). Groups are specified using group aliases, which you can look up in the Firebase console. + groups: 'android-sonata' + # A flag you can include to print verbose log output. + debug: 'true' + + - name: Cleanup sensitive files and directories + run: | + echo "Cleaning up sensitive files..." + rm -rf app + rm -rf buildSrc From 3b5fe1880f98d457cd262c7422524de1241a5044 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Fri, 10 Oct 2025 18:33:57 +0530 Subject: [PATCH 13/14] Update Staging.yml --- .github/workflows/Staging.yml | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 40f36dcc3..556e94b80 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -122,29 +122,7 @@ jobs: with: name: app-staging-${{ github.run_number }} path: apps/app-staging-${{ github.run_number }}.zip - - - name: Install Firebase CLI - if: ${{ github.event.inputs.publish_to_firebase == 'true' }} - run: npm install -g firebase-tools - - - name: Authenticate Firebase CLI - if: ${{ github.event.inputs.publish_to_firebase == 'true' }} - run: | - echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}" | base64 -d > firebase-key.json - firebase login:ci --token "$(cat firebase-key.json)" - - - name: Publish to Firebase App Distribution - if: ${{ github.event.inputs.publish_to_firebase == 'true' }} - run: | - firebase appdistribution:distribute apps/output/student-twou-debug.apk \ - --app ${{ secrets.FIREBASE_APP_ID_DEGREES }} \ - --release-notes "Automated build from GitHub Actions" - - - name: Cleanup sensitive files and directories - run: | - echo "Cleaning up sensitive files..." - rm -rf apps - + - name: Authenticate Firebase CLI # if: ${{ github.event.inputs.publish_to_firebase == 'true' }} run: | @@ -155,7 +133,7 @@ jobs: uses: gowthamraj281/firebase-app-distribution@v1 with: # The release binary file to upload. - file: apps/student/build/outputs/apk/twou/debug/student-twou-debug.apk + file: apps/output/student-twou-debug.apk # Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page. app: ${{ secrets.FIREBASE_APP_ID_DEGREES }} # Path to the Google service account credentials file From 950190627b769a4fd063bf410a3ef71a9347e3e2 Mon Sep 17 00:00:00 2001 From: srajupusapati Date: Tue, 21 Oct 2025 16:13:38 +0530 Subject: [PATCH 14/14] Added VersionName and VersionCode changes --- .github/workflows/Staging.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Staging.yml b/.github/workflows/Staging.yml index 556e94b80..03cf9a9ad 100644 --- a/.github/workflows/Staging.yml +++ b/.github/workflows/Staging.yml @@ -1,8 +1,8 @@ -name: Staging CI +name: 'Staging CI Run' on: pull_request: - branches: [ "surya-test" ] + branches: [ "master" ] workflow_dispatch: inputs: @@ -10,16 +10,16 @@ on: description: 'Run Unit Tests' required: true type: boolean - default: true + default: false branch: description: 'Branch to build' required: true - default: 'develop' + default: 'master' publish_to_firebase: description: 'Publish to Firebase App Distribution' required: true type: boolean - default: false + default: true jobs: build: @@ -81,6 +81,22 @@ jobs: cd apps chmod +x gradlew + - name: Set version info + run: | + VERSION_CODE=${{ github.run_number }} + echo "VERSION_CODE: $VERSION_CODE" + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + VERSION_NAME="PR-${{ github.event.pull_request.number }}" + else + VERSION_NAME="${{ github.event.inputs.branch }}" + fi + echo "VERSION_NAME: $VERSION_NAME" + + sed -i "s/const val versionCode = [0-9]\+/const val versionCode = $VERSION_CODE/" buildSrc/src/main/java/Dependencies.kt + sed -i 's/const val versionName = "[^"]*"/const val versionName = "'"$VERSION_NAME"'"/' buildSrc/src/main/java/Dependencies.kt + + - name: Run Unit Tests if: ${{ github.event.inputs.run_unit_tests == 'true' }} run: |