mirror of
https://github.com/openMF/mifos-mobile.git
synced 2026-02-06 11:26:51 +00:00
refactor(fastlane): update Fastfile and configs files to match with KMP project (#2966)
This commit is contained in:
parent
1e5855c351
commit
a6713db018
@ -1,15 +1,37 @@
|
|||||||
module FastlaneConfig
|
module FastlaneConfig
|
||||||
module IosConfig
|
module IosConfig
|
||||||
FIREBASE_CONFIG = {
|
FIREBASE_CONFIG = {
|
||||||
firebase_app_id: "1:728434912738:ios:shjhsa78392shja",
|
firebase_app_id: "1:728434912738:ios:ee2e0815a6915b351a1dbb",
|
||||||
firebase_service_creds_file: "secrets/firebaseAppDistributionServiceCredentialsFile.json",
|
firebase_service_creds_file: "secrets/firebaseAppDistributionServiceCredentialsFile.json",
|
||||||
firebase_groups: "mifos-mobile-apps"
|
firebase_groups: "mifos-mobile-apps"
|
||||||
}
|
}
|
||||||
|
|
||||||
BUILD_CONFIG = {
|
BUILD_CONFIG = {
|
||||||
project_path: "cmp-ios/iosApp.xcodeproj",
|
project_path: "cmp-ios/iosApp.xcodeproj",
|
||||||
scheme: "iosApp",
|
workspace_path: "cmp-ios/iosApp.xcworkspace",
|
||||||
output_directory: "cmp-ios/build"
|
configuration: "Release",
|
||||||
|
podfile_path: "cmp-ios/Podfile",
|
||||||
|
plist_path: "cmp-ios/iosApp/Info.plist",
|
||||||
|
scheme: "cmp-ios",
|
||||||
|
output_name: "iosApp.ipa",
|
||||||
|
output_directory: "cmp-ios/build",
|
||||||
|
match_git_private_key: "./secrets/match_ci_key",
|
||||||
|
target: "iosApp",
|
||||||
|
team_id: "L432S2FZP5",
|
||||||
|
code_sign_identity: "Apple Distribution",
|
||||||
|
match_type: "adhoc",
|
||||||
|
app_identifier: "org.mifos.mobile",
|
||||||
|
provisioning_profile_name: "match AdHoc org.mifos.mobile",
|
||||||
|
git_url: "git@github.com:openMF/ios-provisioning-profile.git",
|
||||||
|
git_branch: "mifos-mobile",
|
||||||
|
key_id: "7V3ABCDEFG",
|
||||||
|
issuer_id: "7ab9e231-9603-4c3e-a147-be3b0f123456",
|
||||||
|
key_filepath: "./secrets/Auth_key.p8",
|
||||||
|
version_number: "1.0.0",
|
||||||
|
metadata_path: "./fastlane/metadata/ios",
|
||||||
|
app_rating_config_path: "./fastlane/age_rating.json",
|
||||||
|
screenshots_ios_path: "./fastlane/screenshots_ios",
|
||||||
|
screenshots_macos_path: "./fastlane/screenshots_macos",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -132,7 +132,6 @@ platform :android do
|
|||||||
skip_upload_metadata: true,
|
skip_upload_metadata: true,
|
||||||
skip_upload_images: true,
|
skip_upload_images: true,
|
||||||
skip_upload_screenshots: true,
|
skip_upload_screenshots: true,
|
||||||
skip_upload_apk: true,
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -320,27 +319,118 @@ platform :android do
|
|||||||
end
|
end
|
||||||
|
|
||||||
platform :ios do
|
platform :ios do
|
||||||
desc "Build iOS application"
|
|
||||||
lane :build_ios do |options|
|
#############################
|
||||||
# Set default configuration if not provided
|
# Shared Private Lane Helpers
|
||||||
options[:configuration] ||= "Debug"
|
#############################
|
||||||
|
|
||||||
|
private_lane :setup_ci_if_needed do
|
||||||
|
unless ENV['CI']
|
||||||
|
UI.message("🖥️ Running locally, skipping CI-specific setup.")
|
||||||
|
else
|
||||||
|
setup_ci
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :load_api_key do |options|
|
||||||
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
|
||||||
update_code_signing_settings(
|
app_store_connect_api_key(
|
||||||
use_automatic_signing: true,
|
key_id: options[:appstore_key_id] || ios_config[:key_id],
|
||||||
path: ios_config[:project_path]
|
issuer_id: options[:appstore_issuer_id] || ios_config[:issuer_id],
|
||||||
)
|
key_filepath: options[:key_filepath] || ios_config[:key_filepath],
|
||||||
|
duration: 1200
|
||||||
build_ios_app(
|
|
||||||
project: ios_config[:project_path],
|
|
||||||
scheme: ios_config[:scheme],
|
|
||||||
configuration: options[:configuration],
|
|
||||||
skip_codesigning: "true",
|
|
||||||
output_directory: ios_config[:output_directory],
|
|
||||||
skip_archive: "true"
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private_lane :fetch_certificates_with_match do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
match(
|
||||||
|
type: options[:match_type] || ios_config[:match_type],
|
||||||
|
app_identifier: options[:app_identifier] || ios_config[:app_identifier],
|
||||||
|
readonly: true,
|
||||||
|
git_url: options[:git_url] || ios_config[:git_url],
|
||||||
|
git_branch: options[:git_branch] || ios_config[:git_branch],
|
||||||
|
git_private_key: options[:git_private_key] || ios_config[:match_git_private_key],
|
||||||
|
force_for_new_devices: true,
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :build_ios_project do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
app_identifier = options[:app_identifier] || ios_config[:app_identifier]
|
||||||
|
provisioning_profile_name = options[:provisioning_profile_name] || ios_config[:provisioning_profile_name]
|
||||||
|
|
||||||
|
cocoapods(
|
||||||
|
podfile: ios_config[:podfile_path],
|
||||||
|
clean_install: true,
|
||||||
|
repo_update: true
|
||||||
|
)
|
||||||
|
|
||||||
|
# Manual signing for your main app target
|
||||||
|
update_code_signing_settings(
|
||||||
|
use_automatic_signing: false,
|
||||||
|
path: ios_config[:project_path],
|
||||||
|
targets: [ios_config[:target]],
|
||||||
|
team_id: ios_config[:team_id],
|
||||||
|
code_sign_identity: ios_config[:code_sign_identity],
|
||||||
|
profile_name: provisioning_profile_name,
|
||||||
|
bundle_identifier: app_identifier
|
||||||
|
)
|
||||||
|
|
||||||
|
build_ios_app(
|
||||||
|
scheme: ios_config[:scheme],
|
||||||
|
workspace: ios_config[:workspace_path],
|
||||||
|
output_name: ios_config[:output_name],
|
||||||
|
output_directory: ios_config[:output_directory],
|
||||||
|
configuration: ios_config[:configuration]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :set_plist_values do
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
update_plist(
|
||||||
|
plist_path: ios_config[:plist_path],
|
||||||
|
block: proc do |plist|
|
||||||
|
plist["NSCameraUsageDescription"] = "We use the camera to scan QR codes to send and receive payments."
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Main Public lanes
|
||||||
|
###################
|
||||||
|
|
||||||
|
desc "Build Ios application"
|
||||||
|
lane :build_ios do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
|
||||||
|
cocoapods(
|
||||||
|
podfile: ios_config[:podfile_path],
|
||||||
|
clean_install: true,
|
||||||
|
repo_update: true
|
||||||
|
)
|
||||||
|
|
||||||
|
build_ios_app(
|
||||||
|
scheme: ios_config[:scheme],
|
||||||
|
workspace: ios_config[:workspace_path],
|
||||||
|
output_name: ios_config[:output_name],
|
||||||
|
output_directory: ios_config[:output_directory],
|
||||||
|
skip_codesigning: true,
|
||||||
|
skip_archive: true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Signed Ios application"
|
||||||
|
lane :build_signed_ios do |options|
|
||||||
|
setup_ci_if_needed
|
||||||
|
load_api_key(options)
|
||||||
|
fetch_certificates_with_match(options)
|
||||||
|
build_ios_project(options)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Increment build number from latest Firebase release"
|
||||||
lane :increment_version do |options|
|
lane :increment_version do |options|
|
||||||
firebase_config = FastlaneConfig.get_firebase_config(:ios)
|
firebase_config = FastlaneConfig.get_firebase_config(:ios)
|
||||||
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
@ -350,26 +440,14 @@ platform :ios do
|
|||||||
service_credentials_file: options[:serviceCredsFile] || firebase_config[:serviceCredsFile]
|
service_credentials_file: options[:serviceCredsFile] || firebase_config[:serviceCredsFile]
|
||||||
)
|
)
|
||||||
|
|
||||||
increment_build_number(
|
if latest_release
|
||||||
xcodeproj: ios_config[:project_path],
|
increment_build_number(
|
||||||
build_number: latest_release[:buildVersion].to_i + 1
|
xcodeproj: ios_config[:project_path],
|
||||||
)
|
build_number: latest_release[:buildVersion].to_i + 1
|
||||||
end
|
)
|
||||||
|
else
|
||||||
desc "Upload iOS application to Firebase App Distribution"
|
UI.important("⚠️ No existing Firebase release found. Skipping build number increment.")
|
||||||
lane :deploy_on_firebase do |options|
|
end
|
||||||
firebase_config = FastlaneConfig.get_firebase_config(:ios)
|
|
||||||
|
|
||||||
increment_version(serviceCredsFile: firebase_config[:serviceCredsFile])
|
|
||||||
build_ios()
|
|
||||||
releaseNotes = generateReleaseNote()
|
|
||||||
|
|
||||||
firebase_app_distribution(
|
|
||||||
app: firebase_config[:appId],
|
|
||||||
service_credentials_file: firebase_config[:serviceCredsFile],
|
|
||||||
release_notes: releaseNotes,
|
|
||||||
groups: firebase_config[:groups]
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Generate release notes"
|
desc "Generate release notes"
|
||||||
@ -380,4 +458,264 @@ platform :ios do
|
|||||||
)
|
)
|
||||||
releaseNotes
|
releaseNotes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Upload iOS application to Firebase App Distribution"
|
||||||
|
lane :deploy_on_firebase do |options|
|
||||||
|
firebase_config = FastlaneConfig.get_firebase_config(:ios)
|
||||||
|
|
||||||
|
increment_version(serviceCredsFile: firebase_config[:serviceCredsFile])
|
||||||
|
|
||||||
|
build_signed_ios(
|
||||||
|
options.merge(
|
||||||
|
match_type: "adhoc",
|
||||||
|
provisioning_profile_name: "match AdHoc org.mifospay"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
releaseNotes = generateReleaseNote()
|
||||||
|
|
||||||
|
firebase_app_distribution(
|
||||||
|
app: options[:firebase_app_id] || firebase_config[:appId],
|
||||||
|
service_credentials_file: options[:serviceCredsFile] || firebase_config[:serviceCredsFile],
|
||||||
|
release_notes: releaseNotes,
|
||||||
|
groups: options[:groups] || firebase_config[:groups]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Upload beta build to TestFlight"
|
||||||
|
lane :beta 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],
|
||||||
|
version: ios_config[:version_number]
|
||||||
|
)
|
||||||
|
|
||||||
|
increment_build_number(
|
||||||
|
xcodeproj: ios_config[:project_path],
|
||||||
|
build_number: latest_build_number + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set_plist_values
|
||||||
|
|
||||||
|
build_ios_project(
|
||||||
|
options.merge(
|
||||||
|
provisioning_profile_name: "match AppStore org.mifospay"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
pilot(
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY],
|
||||||
|
skip_waiting_for_build_processing: true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Upload iOS Application to AppStore"
|
||||||
|
lane :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],
|
||||||
|
version: ios_config[:version_number]
|
||||||
|
)
|
||||||
|
|
||||||
|
increment_build_number(
|
||||||
|
xcodeproj: ios_config[:project_path],
|
||||||
|
build_number: latest_build_number + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set_plist_values
|
||||||
|
|
||||||
|
build_ios_project(
|
||||||
|
options.merge(
|
||||||
|
provisioning_profile_name: "match AppStore org.mifospay"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
deliver(
|
||||||
|
metadata_path: options[:metadata_path] || ios_config[:metadata_path],
|
||||||
|
submit_for_review: false, # Set to true if you want to auto-submit for review
|
||||||
|
automatic_release: true, # Set to true if you want to auto-release once it approved
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY],
|
||||||
|
skip_app_version_update: false,
|
||||||
|
force: true, # Skips HTML report verification
|
||||||
|
precheck_include_in_app_purchases: false,
|
||||||
|
overwrite_screenshots: true,
|
||||||
|
reject_if_possible: true,
|
||||||
|
app_rating_config_path: ios_config[:app_rating_config_path],
|
||||||
|
submission_information: {
|
||||||
|
add_id_info_uses_idfa: false,
|
||||||
|
add_id_info_limits_tracking: false,
|
||||||
|
add_id_info_serves_ads: false,
|
||||||
|
add_id_info_tracks_action: false,
|
||||||
|
add_id_info_tracks_install: false,
|
||||||
|
content_rights_has_rights: true,
|
||||||
|
content_rights_contains_third_party_content: false,
|
||||||
|
export_compliance_platform: 'ios',
|
||||||
|
export_compliance_compliance_required: false,
|
||||||
|
export_compliance_encryption_updated: false,
|
||||||
|
export_compliance_app_type: nil,
|
||||||
|
export_compliance_uses_encryption: false,
|
||||||
|
export_compliance_is_exempt: true,
|
||||||
|
export_compliance_contains_third_party_cryptography: false,
|
||||||
|
export_compliance_contains_proprietary_cryptography: false,
|
||||||
|
export_compliance_available_on_french_store: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
platform :mac do
|
||||||
|
#############################
|
||||||
|
# Shared Private Lane Helpers
|
||||||
|
#############################
|
||||||
|
|
||||||
|
private_lane :setup_ci_if_needed do
|
||||||
|
if ENV['CI']
|
||||||
|
setup_ci
|
||||||
|
else
|
||||||
|
UI.message("🖥️ Running locally, skipping CI-specific setup.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :load_api_key_macos do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
|
||||||
|
app_store_connect_api_key(
|
||||||
|
key_id: options[:appstore_key_id] || ios_config[:key_id],
|
||||||
|
issuer_id: options[:appstore_issuer_id] || ios_config[:issuer_id],
|
||||||
|
key_filepath: options[:key_filepath] || ios_config[:key_filepath],
|
||||||
|
duration: 1200
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :next_macos_build_number do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
|
||||||
|
latest = latest_testflight_build_number(
|
||||||
|
app_identifier: options[:app_identifier] || ios_config[:app_identifier],
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY],
|
||||||
|
platform: "osx",
|
||||||
|
version: ios_config[:version_number]
|
||||||
|
)
|
||||||
|
(latest.to_i + 1).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
# Resolve the most-recent generated .pkg path
|
||||||
|
private_lane :find_pkg_path do
|
||||||
|
project_dir = File.expand_path('..', Dir.pwd)
|
||||||
|
Dir[File.join(project_dir, 'cmp-desktop', 'build', 'release', '**', 'pkg', '*.pkg')]
|
||||||
|
.max_by { |p| File.mtime(p) } || UI.user_error!('PKG not found!')
|
||||||
|
end
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Public lanes
|
||||||
|
###################
|
||||||
|
|
||||||
|
desc "Build & upload macOS (.pkg) to TestFlight"
|
||||||
|
lane :desktop_testflight do |options|
|
||||||
|
setup_ci_if_needed
|
||||||
|
load_api_key_macos(options)
|
||||||
|
|
||||||
|
new_build_number = next_macos_build_number(options)
|
||||||
|
|
||||||
|
gradle(
|
||||||
|
tasks: ["packageReleasePkg"],
|
||||||
|
properties: {
|
||||||
|
"buildNumber" => new_build_number,
|
||||||
|
"macOsAppStoreRelease" => true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
pkg_path = find_pkg_path
|
||||||
|
UI.message("Found PKG at: #{pkg_path}")
|
||||||
|
|
||||||
|
pilot(
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY],
|
||||||
|
pkg: pkg_path,
|
||||||
|
app_platform: 'osx',
|
||||||
|
skip_waiting_for_build_processing: true,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build & submit macOS app to App Store (non-beta)"
|
||||||
|
lane :desktop_release do |options|
|
||||||
|
ios_config = FastlaneConfig::IosConfig::BUILD_CONFIG
|
||||||
|
setup_ci_if_needed
|
||||||
|
load_api_key_macos(options)
|
||||||
|
|
||||||
|
new_build_number = next_macos_build_number(options)
|
||||||
|
|
||||||
|
gradle(
|
||||||
|
tasks: ["packageReleasePkg"],
|
||||||
|
properties: {
|
||||||
|
"buildNumber" => new_build_number,
|
||||||
|
"macOsAppStoreRelease" => true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Locate the produced PKG (adjust pattern if you rename)
|
||||||
|
pkg_path = find_pkg_path
|
||||||
|
UI.message("Found PKG at: #{pkg_path}")
|
||||||
|
|
||||||
|
deliver(
|
||||||
|
platform: 'osx',
|
||||||
|
pkg: pkg_path,
|
||||||
|
screenshots_path: ios_config[:screenshots_macos_path],
|
||||||
|
metadata_path: options[:metadata_path] || ios_config[:metadata_path],
|
||||||
|
submit_for_review: true, # Set to true if you want to auto-submit for review
|
||||||
|
automatic_release: true, # Set to true if you want to auto-release once it approved
|
||||||
|
api_key: Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY],
|
||||||
|
skip_app_version_update: false,
|
||||||
|
force: true, # Skips HTML report verification
|
||||||
|
precheck_include_in_app_purchases: false,
|
||||||
|
overwrite_screenshots: true,
|
||||||
|
reject_if_possible: true,
|
||||||
|
app_rating_config_path: ios_config[:app_rating_config_path],
|
||||||
|
submission_information: {
|
||||||
|
add_id_info_uses_idfa: false,
|
||||||
|
add_id_info_limits_tracking: false,
|
||||||
|
add_id_info_serves_ads: false,
|
||||||
|
add_id_info_tracks_action: false,
|
||||||
|
add_id_info_tracks_install: false,
|
||||||
|
content_rights_has_rights: true,
|
||||||
|
content_rights_contains_third_party_content: false,
|
||||||
|
export_compliance_platform: 'osx',
|
||||||
|
export_compliance_compliance_required: false,
|
||||||
|
export_compliance_encryption_updated: false,
|
||||||
|
export_compliance_app_type: nil,
|
||||||
|
export_compliance_uses_encryption: false,
|
||||||
|
export_compliance_is_exempt: true,
|
||||||
|
export_compliance_contains_third_party_cryptography: false,
|
||||||
|
export_compliance_contains_proprietary_cryptography: false,
|
||||||
|
export_compliance_available_on_french_store: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Loading…
Reference in New Issue
Block a user