Skip to content

Commit f0d3d72

Browse files
authored
chore(actions): Migrated Android & iOS Workflows to use Fastlane (openMF#1841)
* chore: Update web dependencies Updated the following dependencies: - Upgraded `enhanced-resolve` from 5.17.0 to 5.18.0 - Upgraded `karma` from 6.4.3 to 6.4.4 - Upgraded `kotlin-web-helpers` to 2.0.0 - Upgraded `mocha` from 10.7.0 to 10.7.3 - Upgraded `webpack` from 5.93.0 to 5.94.0 - Upgraded `ws` from 8.5.0 to 8.18.0 Removed the following dependencies: - `@types/eslint` - `@types/eslint-scope` Also, updated the multi-platform build and publish workflow to use `niyajali/mifos-mobile-github-actions` instead of `openMF/mifos-mobile-github-actions`. * ci: Update GitHub Actions workflow This commit updates the GitHub Actions workflows to: - Remove the pull request trigger from the `build-and-deploy-site` workflow. The workflow will now only be triggered manually or on a schedule. - Add `build_ios` as an input to the `multi-platform-build-and-publish` workflow to control whether the iOS app should be built. - Remove unused inputs from the `multi-platform-build-and-publish` workflow, including `publish_desktop` and `publish_web`. * chore: Add Fastlane lanes and update workflows This commit introduces new Fastlane lanes for Android and iOS: - **Android:** - `assembleDebugApks`: Assembles debug APKs. - `assembleReleaseApks`: Assembles release APKs using a keystore. - `bundlePlayStoreRelease`: Bundles a Play Store release, including generating a version and release notes. - `deploy_on_firebase`: Deploys the release APK to Firebase App Distribution. - `buildAndSignApp`: A private lane to build and sign the app with provided keystore credentials. - `generateVersion`: Generates and sets version information. - `generateReleaseNotes`: Generates release notes from git commits. - **iOS:** - `build_ios`: Builds the iOS app with optional configuration (defaults to Debug). - `increment_version`: Increments the build number using Firebase App Distribution's latest release. - `deploy_on_firebase`: Deploys the iOS app to Firebase App Distribution, including incrementing the build number. - `generateReleaseNotes`: Generates release notes from git commits. It also updates the following workflows: - **promote-to-production.yml**: Removes the manual trigger and workflow dispatch, making it only triggered by GitHub releases. - **tag-weekly-release.yml**: Updates the cron schedule to run weekly. - **multi-platform-build-and-publish.yml**: Switches back to using `openMF/mifos-mobile-github-actions` instead of `niyajali/mifos-mobile-github-actions`. Additionally, it relocates the keystore to a `keystores` directory, updates the `build.gradle.kts` file to reflect this change, and adds necessary metadata for the Play Store. It also updates the `AppFile` to use the playStorePublishServiceCredentialsFile from the secrets directory and adds a `secrets` directory to the `.gitignore`. * ci: Remove `publish_android` input from multi-platform workflow This commit removes the `publish_android` input from the `multi-platform-build-and-publish` workflow. This input was previously used to control whether the Android app should be published to the Play Store. Since this functionality is no longer required, the input has been removed to simplify the workflow configuration. * chore: Remove `repoName` param from `generateReleaseNotes` lane This commit removes the `repoName` parameter from the `generateReleaseNotes` lane in the Fastfile. The `repoName` parameter is no longer needed as the lane now automatically determines the repository name. This change simplifies the `generateReleaseNotes` lane and makes it more robust.
1 parent 6320f20 commit f0d3d72

28 files changed

+198
-77
lines changed

.github/workflows/multi-platform-build-and-publish.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ on:
7474
default: 'dev'
7575
description: 'Target branch for release'
7676

77-
publish_android:
78-
type: boolean
79-
default: false
80-
description: Publish Android App On Play Store
81-
8277
build_ios:
8378
type: boolean
8479
default: false
@@ -101,15 +96,15 @@ concurrency:
10196
jobs:
10297
multi_platform_build_and_publish:
10398
name: Multi-Platform Build and Publish
104-
uses: niyajali/mifos-mobile-github-actions/.github/workflows/multi-platform-build-and-publish.yaml@main
99+
uses: openMF/mifos-mobile-github-actions/.github/workflows/multi-platform-build-and-publish.yaml@main
105100
with:
106101
release_type: ${{ inputs.release_type }}
107102
target_branch: ${{ inputs.target_branch }}
108103
android_package_name: 'mifospay-android' # <-- Change this to your android package name
109104
ios_package_name: 'mifospay-ios' # <-- Change this to your ios package name
110105
desktop_package_name: 'mifospay-desktop' # <-- Change this to your desktop package name
111106
web_package_name: 'mifospay-web' # <-- Change this to your web package name
112-
publish_android: ${{ inputs.publish_android }}
107+
tester_groups: 'mobile-wallet-testing' # <-- Change this to your Firebase tester group
113108
build_ios: ${{ inputs.build_ios }}
114109
publish_ios: ${{ inputs.publish_ios }}
115110
secrets:

.github/workflows/promote-to-production.yml

-9
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ name: Promote Release to Play Store
5656
# 2. Automatic trigger when a GitHub release is published
5757
on:
5858
workflow_dispatch:
59-
inputs:
60-
publish_to_play_store:
61-
required: false
62-
default: false
63-
description: Publish to Play Store?
64-
type: boolean
6559
release:
6660
types: [ released ]
6761

@@ -77,8 +71,5 @@ jobs:
7771
play_promote_production:
7872
name: Promote Beta to Production Play Store
7973
uses: openMF/mifos-mobile-github-actions/.github/workflows/promote-to-production.yaml@main
80-
if: ${{ inputs.publish_to_play_store == true }}
8174
secrets:
8275
playstore_creds: ${{ secrets.PLAYSTORECREDS }}
83-
with:
84-
android_package_name: 'mifospay-android'

.github/workflows/tag-weekly-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ on:
6767
schedule:
6868
# Runs at 04:00 UTC every Sunday
6969
# Cron syntax: minute hour day-of-month month day-of-week
70-
- cron: '0 4 */2 * 0'
70+
- cron: '0 4 * * 0'
7171

7272
concurrency:
7373
group: "weekly-release"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ playStorePublishServiceCredentialsFile.json
7171
# Ruby stuff we don't care about
7272
.bundle/
7373
vendor/
74+
secrets/

fastlane/AppFile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
json_key_file("mifospay-android/playStorePublishServiceCredentialsFile.json")
1+
json_key_file("secrets/playStorePublishServiceCredentialsFile.json")
22
package_name("org.mifospay") # e.g. org.mifospay.demo

fastlane/FastFile

+188-58
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,85 @@
11
default_platform(:android)
22

33
platform :android do
4+
desc "Assemble debug APKs."
5+
lane :assembleDebugApks do |options|
6+
gradle(
7+
tasks: ["assembleDebug"],
8+
)
9+
end
10+
11+
desc "Assemble Release APK"
12+
lane :assembleReleaseApks do |options|
13+
options[:storeFile] ||= "release_keystore.keystore"
14+
options[:storePassword] ||= "Mifospay"
15+
options[:keyAlias] ||= "key0"
16+
options[:keyPassword] ||= "Mifos@123"
17+
18+
# Generate version
19+
generateVersion = generateVersion()
20+
21+
buildAndSignApp(
22+
taskName: "assemble",
23+
buildType: "Release",
24+
storeFile: options[:storeFile],
25+
storePassword: options[:storePassword],
26+
keyAlias: options[:keyAlias],
27+
keyPassword: options[:keyPassword],
28+
)
29+
end
30+
31+
desc "Bundle Play Store release"
32+
lane :bundlePlayStoreRelease do |options|
33+
options[:storeFile] ||= "release_keystore.keystore"
34+
options[:storePassword] ||= "Mifospay"
35+
options[:keyAlias] ||= "key0"
36+
options[:keyPassword] ||= "Mifos@123"
37+
38+
# Generate version
39+
generateVersion = generateVersion()
40+
41+
# Generate Release Note
42+
releaseNotes = generateReleaseNotes()
43+
44+
# Write the generated release notes to default.txt
45+
buildConfigPath = "metadata/android/en-GB/changelogs/default.txt"
46+
File.write(buildConfigPath, releaseNotes)
47+
48+
buildAndSignApp(
49+
taskName: "bundle",
50+
buildType: "Release",
51+
storeFile: options[:storeFile],
52+
storePassword: options[:storePassword],
53+
keyAlias: options[:keyAlias],
54+
keyPassword: options[:keyPassword],
55+
)
56+
end
57+
58+
desc "Publish Release Play Store artifacts to Firebase App Distribution"
59+
lane :deploy_on_firebase do |options|
60+
options[:apkFile] ||= "mifospay-android/build/outputs/apk/prod/release/mifospay-android-prod-release.apk"
61+
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"
62+
options[:groups] ||= "mifos-wallet-testers"
63+
64+
# Generate Release Note
65+
releaseNotes = generateReleaseNotes()
66+
67+
firebase_app_distribution(
68+
app: "1:64530857057:android:f8d67b786db1b844",
69+
android_artifact_type: "APK",
70+
android_artifact_path: options[:apkFile],
71+
service_credentials_file: options[:serviceCredsFile],
72+
groups: options[:groups],
73+
release_notes: "#{releaseNotes}",
74+
)
75+
end
76+
477
desc "Deploy internal tracks to Google Play"
5-
lane :deploy_internal do
6-
supply(
78+
lane :deploy_internal do |options|
79+
options[:aabFile] ||= "mifospay-android/build/outputs/bundle/prodRelease/mifospay-android-prod-release.aab"
80+
upload_to_play_store(
781
track: 'internal',
8-
aab: 'mifospay-android/build/outputs/bundle/prodRelease/mifospay-android-prod-release.aab',
82+
aab: options[:aabFile],
983
skip_upload_metadata: true,
1084
skip_upload_images: true,
1185
skip_upload_screenshots: true,
@@ -14,7 +88,7 @@ platform :android do
1488

1589
desc "Promote internal tracks to beta on Google Play"
1690
lane :promote_to_beta do
17-
supply(
91+
upload_to_play_store(
1892
track: 'internal',
1993
track_promote_to: 'beta',
2094
skip_upload_changelogs: true,
@@ -26,73 +100,129 @@ platform :android do
26100

27101
desc "Promote beta tracks to production on Google Play"
28102
lane :promote_to_production do
29-
supply(
103+
upload_to_play_store(
30104
track: 'beta',
31105
track_promote_to: 'production',
32106
skip_upload_changelogs: true,
33-
sync_image_upload: true,
107+
skip_upload_metadata: true,
108+
skip_upload_images: true,
109+
skip_upload_screenshots: true,
34110
)
35111
end
36112

37-
desc "Upload Android application to Firebase App Distribution"
38-
lane :deploy_on_firebase do
39-
release = firebase_app_distribution(
40-
app: "1:728434912738:android:0490c291986f0a691a1dbb",
41-
service_credentials_file: "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json",
42-
release_notes_file: "mifospay-android/build/outputs/changelogBeta",
43-
android_artifact_type: "APK",
44-
android_artifact_path: "mifospay-android/build/outputs/apk/prod/release/mifospay-android-prod-release.apk",
45-
groups: "mifos-wallet-testers"
113+
desc "Generate artifacts for the given [build] signed with the provided [keystore] and credentials."
114+
private_lane :buildAndSignApp do |options|
115+
# Get the project root directory
116+
project_dir = File.expand_path('..', Dir.pwd)
117+
118+
# Construct the absolute path to the keystore
119+
keystore_path = File.join(project_dir, 'keystores', options[:storeFile])
120+
121+
# Check if keystore exists
122+
unless File.exist?(keystore_path)
123+
UI.error "Keystore file not found at: #{keystore_path}"
124+
UI.error "Please ensure the keystore file exists at the correct location"
125+
exit 1 # Exit with error code 1
126+
end
127+
128+
gradle(
129+
task: options[:taskName],
130+
build_type: options[:buildType],
131+
properties: {
132+
"android.injected.signing.store.file" => keystore_path,
133+
"android.injected.signing.store.password" => options[:storePassword],
134+
"android.injected.signing.key.alias" => options[:keyAlias],
135+
"android.injected.signing.key.password" => options[:keyPassword],
136+
},
137+
print_command: false,
46138
)
47139
end
48140

49-
end
141+
desc "Generate Version"
142+
lane :generateVersion do
143+
# Generate version file
144+
gradle(tasks: ["versionFile"])
145+
146+
# Set version from file
147+
ENV['VERSION'] = File.read("../version.txt").strip
148+
149+
# Calculate and set version code
150+
commit_count = `git rev-list --count HEAD`.to_i
151+
tag_count = `git tag | grep -v beta | wc -l`.to_i
152+
ENV['VERSION_CODE'] = ((commit_count + tag_count) << 1).to_s
153+
154+
UI.success("Set VERSION=#{ENV['VERSION']} VERSION_CODE=#{ENV['VERSION_CODE']}")
155+
end
156+
157+
desc "Generate release notes"
158+
lane :generateReleaseNotes do |options|
159+
branchName = `git rev-parse --abbrev-ref HEAD`.chomp()
160+
releaseNotes = changelog_from_git_commits(
161+
commits_count: 1,
162+
)
163+
releaseNotes
164+
end
50165

166+
end
51167

52168
platform :ios do
53-
desc "Build iOS application"
54-
lane :build_ios do
55-
build_ios_app(
56-
project: "mifospay-ios/iosApp.xcodeproj",
57-
scheme: "iosApp",
58-
# Set configuration to debug for now
59-
configuration: "Debug",
60-
output_directory: "mifospay-ios/",
61-
output_name: "mifospay-ios-app.ipa",
62-
skip_codesigning: "true",
63-
skip_archive: "true"
64-
)
65-
end
169+
desc "Build iOS application"
170+
lane :build_ios do |options|
171+
# Set default configuration if not provided
172+
options[:configuration] ||= "Debug"
66173

67-
lane :increment_version do
68-
latest_release = firebase_app_distribution_get_latest_release(
69-
app: "1:728434912738:ios:86a7badfaed88b841a1dbb"
70-
)
71-
increment_build_number(
72-
xcodeproj: "mifospay-ios/iosApp.xcodeproj",
73-
build_number: latest_release[:buildVersion].to_i + 1
74-
)
75-
end
174+
# automatic code signing
175+
update_code_signing_settings(
176+
use_automatic_signing: true,
177+
path: "mifospay-ios/iosApp.xcodeproj"
178+
)
179+
build_ios_app(
180+
project: "mifospay-ios/iosApp.xcodeproj",
181+
scheme: "iosApp",
182+
# Set configuration to debug for now
183+
configuration: options[:configuration],
184+
skip_codesigning: "true",
185+
output_directory: "mifospay-ios/build",
186+
skip_archive: "true"
187+
)
188+
end
76189

77-
desc "Upload iOS application to Firebase App Distribution"
78-
lane :deploy_on_firebase do
79-
increment_build_number(
80-
xcodeproj: "mifospay-ios/iosApp.xcodeproj"
81-
)
82-
83-
build_ios_app(
84-
project: "mifospay-ios/iosApp.xcodeproj",
85-
scheme: "iosApp",
86-
configuration: "Debug",
87-
skip_codesigning: "true",
88-
skip_archive: "true"
89-
)
90-
release = firebase_app_distribution(
91-
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
92-
service_credentials_file: "mifospay-ios/firebaseAppDistributionServiceCredentialsFile.json",
93-
release_notes_file: "mifospay-ios/changelogBeta",
94-
groups: "mifos-wallet-testers"
95-
)
190+
lane :increment_version do |options|
191+
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"
96192

97-
end
193+
latest_release = firebase_app_distribution_get_latest_release(
194+
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
195+
service_credentials_file: options[:serviceCredsFile]
196+
)
197+
increment_build_number(
198+
xcodeproj: "mifospay-ios/iosApp.xcodeproj",
199+
build_number: latest_release[:buildVersion].to_i + 1
200+
)
201+
end
202+
203+
desc "Upload iOS application to Firebase App Distribution"
204+
lane :deploy_on_firebase do |options|
205+
options[:serviceCredsFile] ||= "secrets/firebaseAppDistributionServiceCredentialsFile.json"
206+
options[:groups] ||= "mifos-wallet-testers"
207+
208+
increment_version()
209+
build_ios()
210+
releaseNotes = generateReleaseNotes()
211+
release = firebase_app_distribution(
212+
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
213+
service_credentials_file: options[:serviceCredsFile],
214+
release_notes_file: "#{releaseNotes}",
215+
groups: options[:groups]
216+
)
217+
218+
end
219+
220+
desc "Generate release notes"
221+
lane :generateReleaseNotes do
222+
branchName = `git rev-parse --abbrev-ref HEAD`.chomp()
223+
releaseNotes = changelog_from_git_commits(
224+
commits_count: 1,
225+
)
226+
releaseNotes
227+
end
98228
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Initial Production Release

fastlane/metadata/android/en-GB/changelogs/default.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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
16.8 KB
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A reference implementation of Mifos platform wallet and payment capabilities.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mifos Pay

fastlane/metadata/android/en-GB/video.txt

Whitespace-only changes.
File renamed without changes.

mifospay-android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ android {
3434

3535
signingConfigs {
3636
create("release") {
37-
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "release_keystore.keystore")
37+
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "../keystores/release_keystore.keystore")
3838
storePassword = System.getenv("KEYSTORE_PASSWORD") ?: "Mifospay"
3939
keyAlias = System.getenv("KEYSTORE_ALIAS") ?: "key0"
4040
keyPassword = System.getenv("KEYSTORE_ALIAS_PASSWORD") ?: "Mifos@123"

0 commit comments

Comments
 (0)