chore: Fixed Fastlane & Firebase App Distribution Workflow (#1822)

* Chore: Updated Fastlane and CI for release

This commit adds Fastlane for automating the Android release process and configures CI for internal, beta, and production releases using GitHub Actions.

The following changes were made:

- Added Fastlane configuration files for building, testing, and deploying the app.
- Added GitHub Actions workflows for triggering internal, beta, and production releases.
- Updated .gitignore to exclude Fastlane report files.
- Updated dependency versions in Gemfile.lock.
- Added a README for Fastlane.
- Updated the make_site workflow to trigger on released releases instead of published releases.
This commit is contained in:
Sk Niyaj Ali 2024-11-27 15:19:31 +05:30 committed by GitHub
parent 775fdef9d0
commit 14703f6056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 283 additions and 63 deletions

View File

@ -40,11 +40,13 @@ runs:
env: env:
CREDS: ${{ inputs.playstore-creds }} CREDS: ${{ inputs.playstore-creds }}
run: | run: |
# Create the file with appropriate permissions
touch mifospay-android/playStorePublishServiceCredentialsFile.json
echo $CREDS > mifospay-android/playStorePublishServiceCredentialsFile.json echo $CREDS > mifospay-android/playStorePublishServiceCredentialsFile.json
- name: Inflate firebaseAppDistributionServiceCredentialsFile.json - name: Inflate firebaseAppDistributionServiceCredentialsFile.json
shell: bash shell: bash
env: env:
CREDS: ${{ inputs.firebase-creds }} FIREBASE_CREDS: ${{ inputs.firebase-creds }}
run: | run: |
echo $CREDS > mifospay-android/firebaseAppDistributionServiceCredentialsFile.json echo $FIREBASE_CREDS > mifospay-android/firebaseAppDistributionServiceCredentialsFile.json

View File

@ -12,11 +12,23 @@ on:
- internal - internal
- beta - beta
publish_to_play_store:
required: false
default: false
description: Publish to Play Store?
type: boolean
publish_ios:
required: false
default: false
description: Publish to Firebase iOS App Distribution?
type: boolean
env: env:
SUPPLY_UPLOAD_MAX_RETRIES: 5 SUPPLY_UPLOAD_MAX_RETRIES: 5
jobs: jobs:
build_desktop_app: build_desktop_and_ios_app:
strategy: strategy:
matrix: matrix:
os: os:
@ -41,9 +53,28 @@ jobs:
NOTARIZATION_TEAM_ID: ${{ secrets.NOTARIZATION_TEAM_ID }} NOTARIZATION_TEAM_ID: ${{ secrets.NOTARIZATION_TEAM_ID }}
run: ./gradlew packageReleaseDistributionForCurrentOS run: ./gradlew packageReleaseDistributionForCurrentOS
app_build: - name: Configure Ruby
if: matrix.os == 'macos-latest'
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with:
bundler-cache: true
- name: Install Fastlane
if: matrix.os == 'macos-latest'
run: |
gem install bundler:2.2.27
bundle install --jobs 4 --retry 3
bundle exec fastlane add_plugin firebase_app_distribution
bundle exec fastlane add_plugin increment_build_number
- name: Build iOS App
if: matrix.os == 'macos-latest'
continue-on-error: true
run: bundle exec fastlane ios build_ios
distribute_android_app:
name: Github, Firebase Release name: Github, Firebase Release
needs: [ build_desktop_app ] needs: [ build_desktop_and_ios_app ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@ -58,11 +89,6 @@ jobs:
distribution: 'temurin' distribution: 'temurin'
java-version: '17' java-version: '17'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v4
@ -135,9 +161,47 @@ jobs:
- name: Print `git status` - name: Print `git status`
run: git status run: git status
distribute_ios_app:
name: Build iOS App
if: ${{ github.event.inputs.release_type == 'beta' && github.event.inputs.publish_ios == true }}
needs: [ distribute_android_app ]
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4.2.2
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Configure Ruby
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with:
bundler-cache: true
- name: Install Fastlane
run: |
gem install bundler:2.2.27
bundle install --jobs 4 --retry 3
bundle exec fastlane add_plugin firebase_app_distribution
bundle exec fastlane add_plugin increment_build_number
- name: Upload iOS App to Firebase Distribution
run: bundle exec fastlane ios distribute_ios_app
- name: Print `git status`
run: git status
play_publish: play_publish:
name: Play Publish name: Play Publish
runs-on: ubuntu-latest if: ${{ inputs.publish_to_play_store == true }}
runs-on: macos-latest
concurrency: concurrency:
group: playstore_deploy group: playstore_deploy
permissions: permissions:
@ -153,11 +217,18 @@ jobs:
distribution: 'temurin' distribution: 'temurin'
java-version: '17' java-version: '17'
- uses: ruby/setup-ruby@v1 - name: Configure Ruby
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with: with:
ruby-version: '3.2'
bundler-cache: true bundler-cache: true
- name: Install Fastlane
run: |
gem install bundler:2.2.27
bundle install --jobs 4 --retry 3
bundle exec fastlane add_plugin firebase_app_distribution
bundle exec fastlane add_plugin increment_build_number
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v4

View File

@ -1,12 +1,12 @@
name: Publish Web App name: Publish Web App
on: on:
# Runs on pushes targeting the default branch pull_request:
push:
branches: [ "dev" ] branches: [ "dev" ]
types: [ closed ]
# Trigger on new releases # Trigger on new releases
release: release:
types: [ published ] types: [ released ]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

View File

@ -2,6 +2,12 @@ name: Production Deploy
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
publish_to_play_store:
required: false
default: false
description: Publish to Play Store?
type: boolean
release: release:
types: [ released ] types: [ released ]
@ -11,15 +17,21 @@ env:
jobs: jobs:
play_promote_production: play_promote_production:
name: Play Publish Production name: Play Publish Production
runs-on: ubuntu-latest if: ${{ inputs.publish_to_play_store == true }}
runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1 - name: Configure Ruby
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with: with:
ruby-version: '3.2'
bundler-cache: true bundler-cache: true
- name: Install Bundler
run: |
gem install bundler:2.2.27
bundle install --jobs 4 --retry 3
- uses: ./.github/actions/inflate-secrets - uses: ./.github/actions/inflate-secrets
name: Inflate Secrets name: Inflate Secrets
with: with:
@ -29,4 +41,5 @@ jobs:
firebase-creds: ${{ secrets.FIREBASECREDS }} firebase-creds: ${{ secrets.FIREBASECREDS }}
- name: Promote Beta to Production Play Store - name: Promote Beta to Production Play Store
run: bundle exec fastlane promote_to_production run: |
bundle exec fastlane promote_to_production

7
.gitignore vendored
View File

@ -48,9 +48,6 @@ mifospay-shared/mifospay-shared.podspec
!/.idea/codeStyles/Project.xml !/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml !/.idea/codeStyles/codeStyleConfig.xml
# Gradle cache
.gradle
# Kotlin # Kotlin
.kotlin .kotlin
@ -62,12 +59,12 @@ app/app.iml
app/manifest-merger-release-report.txt app/manifest-merger-release-report.txt
# Exclude Google services from prod flavour # Exclude Google services from prod flavour
mifospay/src/prod/google-services.json mifospay-android/src/prod/google-services.json
#*.keystore #*.keystore
version.txt version.txt
fastlane/report.xml
firebaseAppDistributionServiceCredentialsFile.json firebaseAppDistributionServiceCredentialsFile.json
playStorePublishServiceCredentialsFile.json playStorePublishServiceCredentialsFile.json

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
3.3.5

View File

@ -1,5 +1,7 @@
source "https://rubygems.org" source "https://rubygems.org"
ruby File.read(".ruby-version").strip
gem "fastlane" gem "fastlane"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')

View File

@ -10,20 +10,20 @@ GEM
artifactory (3.0.17) artifactory (3.0.17)
atomos (0.1.3) atomos (0.1.3)
aws-eventstream (1.3.0) aws-eventstream (1.3.0)
aws-partitions (1.971.0) aws-partitions (1.1013.0)
aws-sdk-core (3.203.0) aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0) aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0) aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9) aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1) jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.89.0) aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.203.0) aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5) aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.160.0) aws-sdk-s3 (1.174.0)
aws-sdk-core (~> 3, >= 3.203.0) aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5) aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.1) aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4) babosa (1.0.4)
base64 (0.2.0) base64 (0.2.0)
@ -38,8 +38,8 @@ GEM
domain_name (0.6.20240107) domain_name (0.6.20240107)
dotenv (2.8.1) dotenv (2.8.1)
emoji_regex (3.2.3) emoji_regex (3.2.3)
excon (0.111.0) excon (0.112.0)
faraday (1.10.3) faraday (1.10.4)
faraday-em_http (~> 1.0) faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0) faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1) faraday-excon (~> 1.1)
@ -65,10 +65,10 @@ GEM
faraday-patron (1.0.0) faraday-patron (1.0.0)
faraday-rack (1.0.0) faraday-rack (1.0.0)
faraday-retry (1.0.3) faraday-retry (1.0.3)
faraday_middleware (1.2.0) faraday_middleware (1.2.1)
faraday (~> 1.0) faraday (~> 1.0)
fastimage (2.3.1) fastimage (2.3.1)
fastlane (2.222.0) fastlane (2.225.0)
CFPropertyList (>= 2.3, < 4.0.0) CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0) addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0) artifactory (~> 3.0)
@ -84,6 +84,7 @@ GEM
faraday-cookie_jar (~> 0.0.6) faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 1.0) faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0) fastimage (>= 2.1.0, < 3.0.0)
fastlane-sirp (>= 1.0.0)
gh_inspector (>= 1.1.2, < 2.0.0) gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3) google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1) google-apis-playcustomapp_v1 (~> 0.1)
@ -109,7 +110,12 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0) xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0) xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
fastlane-plugin-increment_version_code (0.4.3) fastlane-plugin-firebase_app_distribution (0.9.1)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
fastlane-plugin-increment_build_number (0.0.4)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
gh_inspector (1.1.3) gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.54.0) google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a) google-apis-core (>= 0.11.0, < 2.a)
@ -121,6 +127,10 @@ GEM
representable (~> 3.0) representable (~> 3.0)
retriable (>= 2.0, < 4.a) retriable (>= 2.0, < 4.a)
rexml rexml
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-firebaseappdistribution_v1alpha (0.2.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0) google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a) google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0) google-apis-playcustomapp_v1 (0.13.0)
@ -152,17 +162,17 @@ GEM
domain_name (~> 0.5) domain_name (~> 0.5)
httpclient (2.8.3) httpclient (2.8.3)
jmespath (1.6.2) jmespath (1.6.2)
json (2.7.2) json (2.8.2)
jwt (2.8.2) jwt (2.9.3)
base64 base64
mini_magick (4.13.2) mini_magick (4.13.2)
mini_mime (1.1.5) mini_mime (1.1.5)
multi_json (1.15.0) multi_json (1.15.0)
multipart-post (2.4.1) multipart-post (2.4.1)
nanaimo (0.3.0) nanaimo (0.4.0)
naturally (2.2.1) naturally (2.2.1)
nkf (0.2.0) nkf (0.2.0)
optparse (0.5.0) optparse (0.6.0)
os (1.1.4) os (1.1.4)
plist (3.7.1) plist (3.7.1)
public_suffix (6.0.1) public_suffix (6.0.1)
@ -172,7 +182,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0) trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0) uber (< 0.2.0)
retriable (3.1.2) retriable (3.1.2)
rexml (3.3.7) rexml (3.3.9)
rouge (2.0.7) rouge (2.0.7)
ruby2_keywords (0.0.5) ruby2_keywords (0.0.5)
rubyzip (2.3.2) rubyzip (2.3.2)
@ -185,6 +195,7 @@ GEM
simctl (1.6.10) simctl (1.6.10)
CFPropertyList CFPropertyList
naturally naturally
sysrandom (1.0.5)
terminal-notifier (2.0.0) terminal-notifier (2.0.0)
terminal-table (3.0.2) terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3) unicode-display_width (>= 1.1.1, < 3)
@ -194,29 +205,31 @@ GEM
tty-spinner (0.9.3) tty-spinner (0.9.3)
tty-cursor (~> 0.7) tty-cursor (~> 0.7)
uber (0.1.0) uber (0.1.0)
unicode-display_width (2.5.0) unicode-display_width (2.6.0)
word_wrap (1.0.0) word_wrap (1.0.0)
xcodeproj (1.25.0) xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0) CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3) atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0) claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1) colored2 (~> 3.1)
nanaimo (~> 0.3.0) nanaimo (~> 0.4.0)
rexml (>= 3.3.2, < 4.0) rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0) xcpretty (0.3.0)
rouge (~> 2.0.7) rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1) xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7) xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS PLATFORMS
arm64-darwin-22 ruby
x64-mingw-ucrt x64-mingw-ucrt
x86_64-linux
DEPENDENCIES DEPENDENCIES
fastlane fastlane
fastlane-plugin-increment_version_code fastlane-plugin-firebase_app_distribution
fastlane-plugin-increment_build_number
RUBY VERSION
ruby 3.3.5p100
BUNDLED WITH BUNDLED WITH
2.5.18 2.5.23

View File

@ -35,3 +35,37 @@ platform :android do
end end
end end
platform :ios do
desc "Build iOS application"
lane :build_ios do
build_ios_app(
project: "mifospay-ios/iosApp.xcodeproj/project.pbxproj",
# Set configuration to debug for now
configuration: "Debug",
output_directory: "mifospay-ios/",
output_name: "mifospay-ios-app"
)
end
desc "Upload iOS application to Firebase App Distribution"
lane :distribute_ios_app do
increment_build_number(
xcodeproj: "mifospay-ios/iosApp.xcodeproj/project.pbxproj"
)
build_ios_app(
project: "mifospay-ios/iosApp.xcodeproj/project.pbxproj",
# Set configuration to debug for now
configuration: "Debug",
)
release = firebase_app_distribution(
app: "1:728434912738:ios:86a7badfaed88b841a1dbb",
service_credentials_file: "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json",
release_notes_file: "mifospay-android/build/outputs/changelogBeta",
groups: "mifos-wallet-testers"
)
end
end

View File

@ -1,5 +1,5 @@
# Autogenerated by fastlane # Autogenerated by fastlane
# #
# Ensure this file is checked in to source control! # Ensure this file is checked in to source control!
gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-increment_version_code' gem 'fastlane-plugin-increment_build_number'

69
fastlane/README.md Normal file
View File

@ -0,0 +1,69 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## Android
### android deploy_internal
```sh
[bundle exec] fastlane android deploy_internal
```
Deploy internal tracks to Google Play
### android promote_to_beta
```sh
[bundle exec] fastlane android promote_to_beta
```
Promote internal tracks to beta on Google Play
### android promote_to_production
```sh
[bundle exec] fastlane android promote_to_production
```
Promote beta tracks to production on Google Play
----
## iOS
### ios build_ios
```sh
[bundle exec] fastlane ios build_ios
```
Build iOS application
### ios distribute_ios_app
```sh
[bundle exec] fastlane ios distribute_ios_app
```
Upload iOS application to Firebase App Distribution
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

18
fastlane/report.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="fastlane.lanes">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.0016609">
</testcase>
<testcase classname="fastlane.lanes" name="1: versionFile" time="38.467327">
</testcase>
</testsuite>
</testsuites>

View File

@ -86,6 +86,12 @@ android {
isIncludeAndroidResources = true isIncludeAndroidResources = true
} }
} }
firebaseAppDistribution {
serviceCredentialsFile = "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json"
releaseNotesFile = "mifospay-android/build/outputs/changelogBeta"
groups = "mifos-wallet-testers"
}
} }
dependencies { dependencies {
@ -144,12 +150,6 @@ dependencyGuard {
} }
} }
firebaseAppDistribution {
serviceCredentialsFile = "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json"
releaseNotesFile = "./mifospay-android/build/outputs/changelogBeta"
groups = "mifos-wallet-testers"
}
// Disable to fix memory leak and be compatible with the configuration cache. // Disable to fix memory leak and be compatible with the configuration cache.
configure<GoogleServicesPluginConfig> { configure<GoogleServicesPluginConfig> {
disableVersionCheck = true disableVersionCheck = true