From 08dfe61eaac29c0421118a220d67395ab8769dee Mon Sep 17 00:00:00 2001 From: Sk Niyaj Ali Date: Tue, 17 Dec 2024 15:49:05 +0530 Subject: [PATCH] Refactor: Migrate CI to Use Github Actions This commit migrates the CI workflows from reusable workflows to local workflows within the repository. This change provides greater control and flexibility in managing the CI process. The following changes were made: - Removed the dependency on the `mifos-mobile-github-actions` repository for CI workflows. - Implemented local workflows for tagging weekly releases, PR checks, and building/publishing multi-platform artifacts. - Updated the weekly release workflow to trigger the multi-platform build and publish workflow for beta releases. - Added package name inputs to the PR check workflow for Android, desktop, web, and iOS platforms. - Removed unused workflows for publishing Android and web apps to Firebase and GitHub Pages, respectively. --- .../deploy-android-app-to-firebase.yaml | 35 --------------- .../deploy-android-app-to-pages.yaml | 29 ------------ .github/workflows/pr-check.yml | 6 ++- .github/workflows/tag-weekly-release.yml | 44 ++++++++++++++++--- Gemfile.lock | 20 ++++----- fastlane/FastFile | 29 +++++++++--- 6 files changed, 73 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/deploy-android-app-to-firebase.yaml delete mode 100644 .github/workflows/deploy-android-app-to-pages.yaml diff --git a/.github/workflows/deploy-android-app-to-firebase.yaml b/.github/workflows/deploy-android-app-to-firebase.yaml deleted file mode 100644 index 74c677e15..000000000 --- a/.github/workflows/deploy-android-app-to-firebase.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Publish Android App on Firebase -on: - workflow_dispatch: - - -jobs: - publish_android_app_on_firebase: - runs-on: macos-latest - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Publish Android App on Firebase - uses: openMF/KMP-android-firebase-publish-action@v1.0.0 - with: - android_package_name: 'mifospay-android' - - keystore_file: ${{ secrets.ORIGINAL_KEYSTORE_FILE }} - keystore_password: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }} - key_alias: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }} - key_password: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }} - - google_services: ${{ secrets.GOOGLESERVICES }} - firebase_creds: ${{ secrets.FIREBASECREDS }} - - github_token: ${{ secrets.GITHUB_TOKEN }} - target_branch: 'dev' - - - - diff --git a/.github/workflows/deploy-android-app-to-pages.yaml b/.github/workflows/deploy-android-app-to-pages.yaml deleted file mode 100644 index 924960d5f..000000000 --- a/.github/workflows/deploy-android-app-to-pages.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Publish Web App - -on: - workflow_dispatch: - -concurrency: - group: "pages" - cancel-in-progress: false - -permissions: - contents: read # Read repository contents - pages: write # Write to GitHub Pages - id-token: write # Write authentication tokens - -jobs: - build_web_app: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - - name: Build & Publish Web App - uses: openMF/KMP-web-publish-action@v1.0.0 - id: deployment - with: - web_package_name: 'mifospay-web' \ No newline at end of file diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 19cc05dac..7b2d64efa 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -84,5 +84,7 @@ jobs: uses: openMF/mifos-mobile-github-actions/.github/workflows/pr-check.yaml@main secrets: inherit with: - android_package_name: 'mifospay-android' - desktop_package_name: 'mifospay-desktop' + android_package_name: 'mifospay-android' # <-- Change Your Android Package Name + desktop_package_name: 'mifospay-desktop' # <-- Change Your Desktop Package Name + web_package_name: 'mifospay-web' # <-- Change Your Web Package Name + ios_package_name: 'mifospay-ios' # <-- Change Your iOS Package Name diff --git a/.github/workflows/tag-weekly-release.yml b/.github/workflows/tag-weekly-release.yml index cc7e6e2d7..3b494debf 100644 --- a/.github/workflows/tag-weekly-release.yml +++ b/.github/workflows/tag-weekly-release.yml @@ -54,9 +54,6 @@ # - Manual workflow dispatch # - Callable from other workflows - -# https://github.com/openMF/mifos-mobile-github-actions/blob/main/.github/workflows/tag-weekly-release.yaml - # ############################################################################## # DON'T EDIT THIS FILE UNLESS NECESSARY # # ############################################################################## @@ -79,7 +76,40 @@ concurrency: jobs: tag: name: Tag Weekly Release - uses: openMF/mifos-mobile-github-actions/.github/workflows/tag-weekly-release.yaml@main - secrets: inherit - with: - target_branch: 'dev' + runs-on: ubuntu-latest + steps: + # Checkout the repository with full history for proper versioning + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Setup Java environment for Gradle operations + - name: Set up JDK 17 + uses: actions/setup-java@v4.2.2 + with: + distribution: 'temurin' + java-version: '17' + + # Create and push a new version tag using Reckon + # This uses the 'final' stage for production-ready releases + - name: Tag Weekly Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew :reckonTagPush -Preckon.stage=final + + # Trigger the build and publish workflow for beta release + # This starts the process of building and deploying the app to various platforms + - name: Trigger Workflow + uses: actions/github-script@v7 + with: + script: | + github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'multi-platform-build-and-publish.yml', + ref: 'dev', + inputs: { + "release_type": "beta", + }, + }) + diff --git a/Gemfile.lock b/Gemfile.lock index b980c483d..19e6f4899 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.1013.0) + aws-partitions (1.1023.0) aws-sdk-core (3.214.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) @@ -19,7 +19,7 @@ GEM aws-sdk-kms (1.96.0) aws-sdk-core (~> 3, >= 3.210.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.174.0) + aws-sdk-s3 (1.176.1) aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) @@ -68,7 +68,7 @@ GEM faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.225.0) + fastlane (2.226.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -108,7 +108,7 @@ GEM tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) + xcpretty (~> 0.4.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) fastlane-plugin-firebase_app_distribution (0.9.1) google-apis-firebaseappdistribution_v1 (~> 0.3.0) @@ -158,11 +158,11 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.7) + http-cookie (1.0.8) domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.2) - json (2.8.2) + json (2.9.0) jwt (2.9.3) base64 mini_magick (4.13.2) @@ -182,8 +182,8 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.3.9) - rouge (2.0.7) + rexml (3.4.0) + rouge (3.28.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.5) @@ -214,8 +214,8 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.4.0) rexml (>= 3.3.6, < 4.0) - xcpretty (0.3.0) - rouge (~> 2.0.7) + xcpretty (0.4.0) + rouge (~> 3.28.0) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) diff --git a/fastlane/FastFile b/fastlane/FastFile index a826267db..105fdf1ce 100644 --- a/fastlane/FastFile +++ b/fastlane/FastFile @@ -53,29 +53,44 @@ platform :ios do desc "Build iOS application" lane :build_ios do build_ios_app( - project: "mifospay-ios/iosApp.xcodeproj/project.pbxproj", + project: "mifospay-ios/iosApp.xcodeproj", + scheme: "iosApp", # Set configuration to debug for now configuration: "Debug", output_directory: "mifospay-ios/", - output_name: "mifospay-ios-app" + output_name: "mifospay-ios-app.ipa", + skip_codesigning: "true", + skip_archive: "true" ) end + lane :increment_version do + latest_release = firebase_app_distribution_get_latest_release( + app: "1:728434912738:ios:86a7badfaed88b841a1dbb" + ) + increment_build_number( + xcodeproj: "mifospay-ios/iosApp.xcodeproj", + build_number: latest_release[:buildVersion].to_i + 1 + ) + end + desc "Upload iOS application to Firebase App Distribution" lane :deploy_on_firebase do increment_build_number( - xcodeproj: "mifospay-ios/iosApp.xcodeproj/project.pbxproj" + xcodeproj: "mifospay-ios/iosApp.xcodeproj" ) build_ios_app( - project: "mifospay-ios/iosApp.xcodeproj/project.pbxproj", - # Set configuration to debug for now + project: "mifospay-ios/iosApp.xcodeproj", + scheme: "iosApp", configuration: "Debug", + skip_codesigning: "true", + skip_archive: "true" ) release = firebase_app_distribution( app: "1:728434912738:ios:86a7badfaed88b841a1dbb", - service_credentials_file: "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json", - release_notes_file: "mifospay-android/build/outputs/changelogBeta", + service_credentials_file: "mifospay-ios/firebaseAppDistributionServiceCredentialsFile.json", + release_notes_file: "mifospay-ios/changelogBeta", groups: "mifos-wallet-testers" )