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

chore(actions): Migrated Android & iOS Workflows to use Fastlane #1841

Merged
merged 7 commits into from
Dec 31, 2024
Merged
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
9 changes: 2 additions & 7 deletions .github/workflows/multi-platform-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ on:
default: 'dev'
description: 'Target branch for release'

publish_android:
type: boolean
default: false
description: Publish Android App On Play Store

build_ios:
type: boolean
default: false
Expand All @@ -101,15 +96,15 @@ concurrency:
jobs:
multi_platform_build_and_publish:
name: Multi-Platform Build and Publish
uses: niyajali/mifos-mobile-github-actions/.github/workflows/multi-platform-build-and-publish.yaml@main
uses: openMF/mifos-mobile-github-actions/.github/workflows/multi-platform-build-and-publish.yaml@main
with:
release_type: ${{ inputs.release_type }}
target_branch: ${{ inputs.target_branch }}
android_package_name: 'mifospay-android' # <-- Change this to your android package name
ios_package_name: 'mifospay-ios' # <-- Change this to your ios package name
desktop_package_name: 'mifospay-desktop' # <-- Change this to your desktop package name
web_package_name: 'mifospay-web' # <-- Change this to your web package name
publish_android: ${{ inputs.publish_android }}
tester_groups: 'mobile-wallet-testing' # <-- Change this to your Firebase tester group
build_ios: ${{ inputs.build_ios }}
publish_ios: ${{ inputs.publish_ios }}
secrets:
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/promote-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ name: Promote Release to Play Store
# 2. Automatic trigger when a GitHub release is published
on:
workflow_dispatch:
inputs:
publish_to_play_store:
required: false
default: false
description: Publish to Play Store?
type: boolean
release:
types: [ released ]

Expand All @@ -77,8 +71,5 @@ jobs:
play_promote_production:
name: Promote Beta to Production Play Store
uses: openMF/mifos-mobile-github-actions/.github/workflows/promote-to-production.yaml@main
if: ${{ inputs.publish_to_play_store == true }}
secrets:
playstore_creds: ${{ secrets.PLAYSTORECREDS }}
with:
android_package_name: 'mifospay-android'
2 changes: 1 addition & 1 deletion .github/workflows/tag-weekly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ on:
schedule:
# Runs at 04:00 UTC every Sunday
# Cron syntax: minute hour day-of-month month day-of-week
- cron: '0 4 */2 * 0'
- cron: '0 4 * * 0'

concurrency:
group: "weekly-release"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ playStorePublishServiceCredentialsFile.json
# Ruby stuff we don't care about
.bundle/
vendor/
secrets/
2 changes: 1 addition & 1 deletion fastlane/AppFile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
json_key_file("mifospay-android/playStorePublishServiceCredentialsFile.json")
json_key_file("secrets/playStorePublishServiceCredentialsFile.json")
package_name("org.mifospay") # e.g. org.mifospay.demo
246 changes: 188 additions & 58 deletions fastlane/FastFile
Original file line number Diff line number Diff line change
@@ -1,11 +1,85 @@
default_platform(:android)

platform :android do
desc "Assemble debug APKs."
lane :assembleDebugApks do |options|
gradle(
tasks: ["assembleDebug"],
)
end

desc "Assemble Release APK"
lane :assembleReleaseApks do |options|
options[:storeFile] ||= "release_keystore.keystore"
options[:storePassword] ||= "Mifospay"
options[:keyAlias] ||= "key0"
options[:keyPassword] ||= "Mifos@123"

# Generate version
generateVersion = generateVersion()

buildAndSignApp(
taskName: "assemble",
buildType: "Release",
storeFile: options[:storeFile],
storePassword: options[:storePassword],
keyAlias: options[:keyAlias],
keyPassword: options[:keyPassword],
)
end

desc "Bundle Play Store release"
lane :bundlePlayStoreRelease do |options|
options[:storeFile] ||= "release_keystore.keystore"
options[:storePassword] ||= "Mifospay"
options[:keyAlias] ||= "key0"
options[:keyPassword] ||= "Mifos@123"

# Generate version
generateVersion = generateVersion()

# Generate Release Note
releaseNotes = generateReleaseNotes()

# Write the generated release notes to default.txt
buildConfigPath = "metadata/android/en-GB/changelogs/default.txt"
File.write(buildConfigPath, releaseNotes)

buildAndSignApp(
taskName: "bundle",
buildType: "Release",
storeFile: options[:storeFile],
storePassword: options[:storePassword],
keyAlias: options[:keyAlias],
keyPassword: options[:keyPassword],
)
end

desc "Publish Release Play Store artifacts to Firebase App Distribution"
lane :deploy_on_firebase do |options|
options[:apkFile] ||= "mifospay-android/build/outputs/apk/prod/release/mifospay-android-prod-release.apk"
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"
options[:groups] ||= "mifos-wallet-testers"

# Generate Release Note
releaseNotes = generateReleaseNotes()

firebase_app_distribution(
app: "1:64530857057:android:f8d67b786db1b844",
android_artifact_type: "APK",
android_artifact_path: options[:apkFile],
service_credentials_file: options[:serviceCredsFile],
groups: options[:groups],
release_notes: "#{releaseNotes}",
)
end

desc "Deploy internal tracks to Google Play"
lane :deploy_internal do
supply(
lane :deploy_internal do |options|
options[:aabFile] ||= "mifospay-android/build/outputs/bundle/prodRelease/mifospay-android-prod-release.aab"
upload_to_play_store(
track: 'internal',
aab: 'mifospay-android/build/outputs/bundle/prodRelease/mifospay-android-prod-release.aab',
aab: options[:aabFile],
skip_upload_metadata: true,
skip_upload_images: true,
skip_upload_screenshots: true,
Expand All @@ -14,7 +88,7 @@ platform :android do

desc "Promote internal tracks to beta on Google Play"
lane :promote_to_beta do
supply(
upload_to_play_store(
track: 'internal',
track_promote_to: 'beta',
skip_upload_changelogs: true,
Expand All @@ -26,73 +100,129 @@ platform :android do

desc "Promote beta tracks to production on Google Play"
lane :promote_to_production do
supply(
upload_to_play_store(
track: 'beta',
track_promote_to: 'production',
skip_upload_changelogs: true,
sync_image_upload: true,
skip_upload_metadata: true,
skip_upload_images: true,
skip_upload_screenshots: true,
)
end

desc "Upload Android application to Firebase App Distribution"
lane :deploy_on_firebase do
release = firebase_app_distribution(
app: "1:728434912738:android:0490c291986f0a691a1dbb",
service_credentials_file: "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json",
release_notes_file: "mifospay-android/build/outputs/changelogBeta",
android_artifact_type: "APK",
android_artifact_path: "mifospay-android/build/outputs/apk/prod/release/mifospay-android-prod-release.apk",
groups: "mifos-wallet-testers"
desc "Generate artifacts for the given [build] signed with the provided [keystore] and credentials."
private_lane :buildAndSignApp do |options|
# Get the project root directory
project_dir = File.expand_path('..', Dir.pwd)

# Construct the absolute path to the keystore
keystore_path = File.join(project_dir, 'keystores', options[:storeFile])

# Check if keystore exists
unless File.exist?(keystore_path)
UI.error "Keystore file not found at: #{keystore_path}"
UI.error "Please ensure the keystore file exists at the correct location"
exit 1 # Exit with error code 1
end

gradle(
task: options[:taskName],
build_type: options[:buildType],
properties: {
"android.injected.signing.store.file" => keystore_path,
"android.injected.signing.store.password" => options[:storePassword],
"android.injected.signing.key.alias" => options[:keyAlias],
"android.injected.signing.key.password" => options[:keyPassword],
},
print_command: false,
)
end

end
desc "Generate Version"
lane :generateVersion do
# Generate version file
gradle(tasks: ["versionFile"])

# Set version from file
ENV['VERSION'] = File.read("../version.txt").strip

# Calculate and set version code
commit_count = `git rev-list --count HEAD`.to_i
tag_count = `git tag | grep -v beta | wc -l`.to_i
ENV['VERSION_CODE'] = ((commit_count + tag_count) << 1).to_s

UI.success("Set VERSION=#{ENV['VERSION']} VERSION_CODE=#{ENV['VERSION_CODE']}")
end

desc "Generate release notes"
lane :generateReleaseNotes do |options|
branchName = `git rev-parse --abbrev-ref HEAD`.chomp()
releaseNotes = changelog_from_git_commits(
commits_count: 1,
)
releaseNotes
end

end

platform :ios do
desc "Build iOS application"
lane :build_ios do
build_ios_app(
project: "mifospay-ios/iosApp.xcodeproj",
scheme: "iosApp",
# Set configuration to debug for now
configuration: "Debug",
output_directory: "mifospay-ios/",
output_name: "mifospay-ios-app.ipa",
skip_codesigning: "true",
skip_archive: "true"
)
end
desc "Build iOS application"
lane :build_ios do |options|
# Set default configuration if not provided
options[:configuration] ||= "Debug"

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
# automatic code signing
update_code_signing_settings(
use_automatic_signing: true,
path: "mifospay-ios/iosApp.xcodeproj"
)
build_ios_app(
project: "mifospay-ios/iosApp.xcodeproj",
scheme: "iosApp",
# Set configuration to debug for now
configuration: options[:configuration],
skip_codesigning: "true",
output_directory: "mifospay-ios/build",
skip_archive: "true"
)
end

desc "Upload iOS application to Firebase App Distribution"
lane :deploy_on_firebase do
increment_build_number(
xcodeproj: "mifospay-ios/iosApp.xcodeproj"
)

build_ios_app(
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-ios/firebaseAppDistributionServiceCredentialsFile.json",
release_notes_file: "mifospay-ios/changelogBeta",
groups: "mifos-wallet-testers"
)
lane :increment_version do |options|
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"

end
latest_release = firebase_app_distribution_get_latest_release(
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
service_credentials_file: options[:serviceCredsFile]
)
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 |options|
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"
options[:groups] ||= "mifos-wallet-testers"

increment_version()
build_ios()
releaseNotes = generateReleaseNotes()
release = firebase_app_distribution(
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
service_credentials_file: options[:serviceCredsFile],
release_notes_file: "#{releaseNotes}",
groups: options[:groups]
)

end

desc "Generate release notes"
lane :generateReleaseNotes do
branchName = `git rev-parse --abbrev-ref HEAD`.chomp()
releaseNotes = changelog_from_git_commits(
commits_count: 1,
)
releaseNotes
end
end
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-GB/changelogs/1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial Production Release
Empty file.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-GB/full_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Mobile Wallet project is a Kotlin Multiplatform (KMP) initiative that leverages the Apache Fineract API. The application has been meticulously crafted using cutting-edge technologies and frameworks/libraries by adhering to recommended architecture and design patterns.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fastlane/metadata/android/en-GB/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-GB/short_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A reference implementation of Mifos platform wallet and payment capabilities.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-GB/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mifos Pay
Empty file.
2 changes: 1 addition & 1 deletion mifospay-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {

signingConfigs {
create("release") {
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "release_keystore.keystore")
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "../keystores/release_keystore.keystore")
storePassword = System.getenv("KEYSTORE_PASSWORD") ?: "Mifospay"
keyAlias = System.getenv("KEYSTORE_ALIAS") ?: "key0"
keyPassword = System.getenv("KEYSTORE_ALIAS_PASSWORD") ?: "Mifos@123"
Expand Down
Loading