Skip to content

refactor(fastlane): Adapted the Fastlane configurations from the KMP Project Template.#2579

Merged
therajanmaurya merged 9 commits intoopenMF:developmentfrom
techsavvy185:fastlane
Jan 30, 2026
Merged

refactor(fastlane): Adapted the Fastlane configurations from the KMP Project Template.#2579
therajanmaurya merged 9 commits intoopenMF:developmentfrom
techsavvy185:fastlane

Conversation

@techsavvy185
Copy link
Contributor

@techsavvy185 techsavvy185 commented Jan 20, 2026

Fixes - Jira-#599

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

  • New Features

    • Centralized project configuration for Android and iOS
    • New iOS lanes and workflows for TestFlight and App Store releases
    • Config export utility to output structured project settings
    • Firebase deployment supports optional app ID override
  • Improvements

    • Consolidated configuration sources for consistency across platforms
    • Streamlined iOS build/signing flow with reusable helpers
    • Version handling now checks existing releases before incrementing
  • Bug Fixes

    • Removed an unnecessary APK upload restriction for Android builds

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Adds a centralized FastlaneConfig::ProjectConfig module and updates Fastlane configs to source Android/iOS settings from it. Introduces an extract_config utility, updates AppFile and fastlane-config/* files to use ProjectConfig, and reorganizes iOS lanes in Fastfile (new helper lanes and public lanes for build/sign/beta/release).

Changes

Cohort / File(s) Change Summary
New central config
fastlane-config/project_config.rb
New FastlaneConfig::ProjectConfig module with PROJECT_NAME, ORGANIZATION_NAME, ANDROID, IOS, IOS_SHARED, SHARED constants, accessors (android_package_name, ios_bundle_identifier, firebase_credentials_file, ios_config), validation and summary helpers.
Config refactors
fastlane-config/android_config.rb, fastlane-config/ios_config.rb
Both now require_relative 'project_config' and read STORE_CONFIG, FIREBASE_CONFIG, BUILD_PATHS/BUILD_CONFIG values from ProjectConfig constants instead of hardcoded literals; iOS adds TESTFLIGHT_CONFIG and APPSTORE_CONFIG.
Fastfile (iOS workflow)
fastlane/FastFile
Reorganized iOS lanes: added private helpers (setup_ci_if_needed, load_api_key, fetch_certificates_with_match, build_ios_project, get_version_from_gradle), public lanes build_ios, build_signed_ios, beta, release, generateFullReleaseNote; increment_version conditional on latest Firebase release; deploy_on_firebase supports appId override.
Fastfile (Android tweaks)
fastlane/FastFile
Android: changed build task from "bundle"→"assemble" in bundleReleaseApks lane; removed skip_upload_apk: true from upload call (affects Play upload behavior).
Extraction tool
fastlane-config/extract_config.rb
New script that emits JSON config derived from FastlaneConfig::ProjectConfig::IOS and IOS_SHARED; includes error handling and pretty-printed output.
AppFile update
fastlane/AppFile
Replaced hardcoded android/ios identifiers and json key paths with dynamic loading via FastlaneConfig::ProjectConfig constants.
Docs/README
fastlane/README.md
Added documentation for new iOS lanes (build_signed_ios, beta, release, generateReleaseNote) and updated descriptions for increment_version and beta usage.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer/CI
    participant Fastlane as Fastfile Lanes
    participant Config as ProjectConfig
    participant Match as match (Certs/Profiles)
    participant Xcode as Xcode / Gradle Build
    participant ASC as App Store Connect
    participant Firebase as Firebase / Google Play

    Dev->>Fastlane: trigger lane (beta/release/deploy_on_firebase)
    Fastlane->>Config: read platform build & firebase config
    Fastlane->>Match: fetch certificates & provisioning
    Match-->>Fastlane: certificates & profiles
    Fastlane->>Xcode: build & sign (uses configs)
    Xcode-->>Fastlane: artifact (IPA/AAB/APK)
    Fastlane->>ASC: upload to TestFlight/App Store (beta/release)
    Fastlane->>Firebase: upload to Firebase/Play (deploy_on_firebase)
    ASC-->>Dev: upload status
    Firebase-->>Dev: upload status
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested reviewers

  • therajanmaurya

Poem

🐰 I found a config, neat and wide,

One ProjectConfig to be my guide.
New lanes to build, sign, and race,
Certs and uploads all in place.
Hopping code, a joyous stride.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—refactoring Fastlane configurations by adapting them from the KMP Project Template. It's specific, clear, and directly relates to the substantial configuration changes across multiple fastlane files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@fastlane-config/project_config.rb`:
- Around line 34-39: The keystore block in project_config.rb contains hardcoded
credentials (keys: keystore, file, password, key_alias, key_password); replace
the plaintext passwords with environment variables and/or a secrets manager
(e.g. use ENV['KEYSTORE_PASSWORD'] and ENV['KEY_PASSWORD'] and ENV['KEY_ALIAS']
for the corresponding values referenced in the keystore hash), ensure the
fastlane code accesses these ENV vars instead of literals, add a clear error or
fail-fast check in the initialization (e.g., validate ENV presence and
raise/exit with a message if missing), and update project CI/README to document
the required environment variables or secret names so the keystore values are
provided securely at runtime.

In `@fastlane/FastFile`:
- Around line 429-435: In the lane :generateReleaseNote remove the unused local
variable branchName (the backtick call `git rev-parse --abbrev-ref
HEAD`.chomp()) since it's assigned but never referenced; update the
generateReleaseNote lane body to simply call changelog_from_git_commits and
return releaseNotes (or return the result directly) so there is no dead
assignment left in the generateReleaseNote lane.
🧹 Nitpick comments (3)
fastlane-config/project_config.rb (1)

134-139: Add trailing comma and consider path resolution robustness.

Two issues:

  1. RuboCop flags a missing trailing comma after the last array element (line 138).
  2. The path resolution File.join(Dir.pwd, '..', file) assumes execution from the fastlane directory, which may not always be the case.
♻️ Proposed fix
       required_files = [
         ANDROID[:play_store_json_key],
         SHARED[:firebase_service_credentials],
         IOS[:app_store_connect][:key_filepath],
-        IOS[:code_signing][:match_git_private_key]
+        IOS[:code_signing][:match_git_private_key],
       ]

-      missing_files = required_files.reject { |file| File.exist?(File.join(Dir.pwd, '..', file)) }
+      project_root = File.expand_path('../..', __dir__)
+      missing_files = required_files.reject { |file| File.exist?(File.join(project_root, file)) }
fastlane-config/ios_config.rb (1)

31-32: Minor: Inconsistent naming between config key and source.

The key app_rating_config_path sources from age_rating_config_path. While functionally correct, this naming inconsistency could cause confusion during maintenance.

Consider aligning the naming:

-      app_rating_config_path: ProjectConfig::IOS[:age_rating_config_path]
+      age_rating_config_path: ProjectConfig::IOS[:age_rating_config_path]

Note: This would require updating references in FastFile (line 550) as well.

fastlane/FastFile (1)

461-497: Consider: Significant code duplication between beta and release lanes.

Both lanes share nearly identical setup logic (CI setup, API key loading, certificate fetching, version/build number incrementing). This duplication could be consolidated into a shared helper.

Based on learnings, since this is synced template code, this refactoring could be deferred to a follow-up issue. However, if you'd like, a shared prepare_for_release helper could reduce ~30 lines of duplication:

private_lane :prepare_for_release do |options|
  ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
  
  setup_ci_if_needed
  load_api_key(options)
  fetch_certificates_with_match(options.merge(match_type: "appstore"))
  
  increment_version_number(
    xcodeproj: ios_config[:project_path],
    version_number: ios_config[:version_number]
  )
  
  latest_build_number = latest_testflight_build_number(
    app_identifier: options[:app_identifier] || ios_config[:app_identifier],
    api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
  )
  
  increment_build_number(
    xcodeproj: ios_config[:project_path],
    build_number: latest_build_number + 1
  )
end

Also applies to: 499-538

@biplab1
Copy link
Contributor

biplab1 commented Jan 23, 2026

@techsavvy185 Can you please tell me the steps you have taken to adapt the Fastlane configuration?

@techsavvy185
Copy link
Contributor Author

@biplab1 So basically I took all the values from the existing android and iOS configs and put references to the actual values in the project config file and replaced the already existing values in the project config file. Although I am not sure if we need to replace other values as well, particularly about the iOS config values since it did not contain that many values before.

@biplab1
Copy link
Contributor

biplab1 commented Jan 23, 2026

@techsavvy185 There are some sections missing from FastFile compared to that of the KMP project template.

@techsavvy185
Copy link
Contributor Author

@biplab1 Ok, I'll make those changes.

@techsavvy185
Copy link
Contributor Author

@biplab1 I have made the required changes. Those parts were missing since they were merged into the KMP template yesterday.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fastlane/FastFile (1)

31-42: Change assemble task to bundle task to generate AAB instead of APK.

bundleReleaseApks uses taskName: "assemble" which produces an APK file. The lane name and deployment pattern (compare to deployInternal at line 124 which correctly uses taskName: "bundleProd") indicate an AAB should be generated instead. Update to taskName: "bundle" or taskName: "bundleRelease" to produce the correct artifact format.

Proposed fix
    buildAndSignApp(
-     taskName: "assemble",
+     taskName: "bundle",
      buildType: "Release",
      **signing_config
    )
🤖 Fix all issues with AI agents
In `@fastlane/FastFile`:
- Around line 448-454: The lanes build_signed_ios, beta, and release call
setup_ci_if_needed without forwarding the lane options, so overrides in
options[:ci_provider] are ignored; update those lanes (the lane definitions
named build_signed_ios, beta, and release) to call setup_ci_if_needed(options)
instead of setup_ci_if_needed so the helper receives the passed options and
respects ci_provider overrides.
- Around line 456-483: The deploy_on_firebase lane currently calls
increment_version without forwarding the firebase_app_id and serviceCredsFile
overrides, so update the deploy_on_firebase invocation of increment_version to
pass options[:firebase_app_id] and options[:serviceCredsFile] (or similarly
named params) through; then modify the increment_version lane to accept and use
those parameters (e.g., check for a passed appId and serviceCredsFile instead of
only using FastlaneConfig.get_firebase_config(:ios)) and use them when calling
firebase_app_distribution_get_latest_release so the appId and credentials used
come from the override rather than the default firebase_config.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fastlane/README.md (1)

117-165: Fix “iOS” capitalization and address MD003 heading-style lint.

Line 117/125 uses “Ios”. Also markdownlint flags the new headings (Lines 119, 127, 135, 151, 159) for MD003; if lint is enforced, align heading style with the repo config or exclude this auto-generated file.

✏️ Suggested text fix
-Build Ios application
+Build iOS application
@@
-Build Signed Ios application
+Build Signed iOS application
🤖 Fix all issues with AI agents
In `@fastlane-config/ios_config.rb`:
- Around line 12-25: BUILD_CONFIG currently includes a dead entry
app_rating_config_path (set from ProjectConfig::IOS[:age_rating_config_path]);
remove the app_rating_config_path key from BUILD_CONFIG to eliminate the unused
configuration, leaving all other keys (app_identifier, project_path,
workspace_path, plist_path, scheme, output_name, output_directory,
version_number, metadata_path) intact so lanes referencing BUILD_CONFIG continue
to work.

In `@fastlane-config/project_config.rb`:
- Around line 258-272: The validate_config method currently builds
required_files and checks existence using File.join(Dir.pwd, '..', file), which
can resolve outside the repo; replace that with an __dir__-anchored project root
(e.g., define a PROJECT_ROOT via File.expand_path('..', __dir__) or similar) and
use File.join(PROJECT_ROOT, file) when constructing missing_files; also fix the
trailing-comma RuboCop lint by removing the extra comma after the last element
in the required_files array (symbols: validate_config, required_files,
missing_files, File.join).

In `@fastlane/AppFile`:
- Around line 1-12: The Fastlane iOS wiring is wrong: change the apple_id call
to use the Apple ID email from FastlaneConfig::ProjectConfig::IOS[:apple_id]
(not the bundle id), set team_id to
FastlaneConfig::ProjectConfig::IOS_SHARED[:team_id] (not IOS[:team_id] which is
nil), and add an explicit
app_identifier(FastlaneConfig::ProjectConfig::IOS[:app_identifier]) call so the
bundle identifier is provided to fastlane; update the apple_id, team_id, and add
app_identifier in the AppFile accordingly.
♻️ Duplicate comments (1)
fastlane-config/project_config.rb (1)

34-39: Avoid hardcoded keystore passwords in source.

Store keystore secrets in environment variables or a secrets manager to prevent leakage and accidental exposure.

🔒 Suggested fix
       keystore: {
         file: "release_keystore.keystore",
-        password: "mifos1234",
+        password: ENV['ANDROID_KEYSTORE_PASSWORD'] || UI.user_error!("ANDROID_KEYSTORE_PASSWORD not set"),
         key_alias: "mifos",
-        key_password: "mifos1234"
+        key_password: ENV['ANDROID_KEY_PASSWORD'] || UI.user_error!("ANDROID_KEY_PASSWORD not set")
       },

@techsavvy185
Copy link
Contributor Author

@biplab1 Could you please look at this one again? I've made all changes.

Copy link
Contributor

@biplab1 biplab1 left a comment

Choose a reason for hiding this comment

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

Looks good to me. This can be merged.

@therajanmaurya therajanmaurya merged commit c72f296 into openMF:development Jan 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants