Skip to content

Commit

Permalink
chore: Fixed Fastlane & Firebase App Distribution Workflow (openMF#1822)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
niyajali authored Nov 27, 2024
1 parent 775fdef commit 14703f6
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 63 deletions.
8 changes: 5 additions & 3 deletions .github/actions/inflate-secrets/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
shell: bash
env:
KEYSTORE: ${{ inputs.keystore }}
run: |
run: |
echo $KEYSTORE | base64 --decode > mifospay-android/release_keystore.keystore
- name: Inflate google-services.json
Expand All @@ -40,11 +40,13 @@ runs:
env:
CREDS: ${{ inputs.playstore-creds }}
run: |
# Create the file with appropriate permissions
touch mifospay-android/playStorePublishServiceCredentialsFile.json
echo $CREDS > mifospay-android/playStorePublishServiceCredentialsFile.json
- name: Inflate firebaseAppDistributionServiceCredentialsFile.json
shell: bash
env:
CREDS: ${{ inputs.firebase-creds }}
FIREBASE_CREDS: ${{ inputs.firebase-creds }}
run: |
echo $CREDS > mifospay-android/firebaseAppDistributionServiceCredentialsFile.json
echo $FIREBASE_CREDS > mifospay-android/firebaseAppDistributionServiceCredentialsFile.json
95 changes: 83 additions & 12 deletions .github/workflows/internal_or_beta_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ on:
- internal
- 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:
SUPPLY_UPLOAD_MAX_RETRIES: 5

jobs:
build_desktop_app:
build_desktop_and_ios_app:
strategy:
matrix:
os:
Expand All @@ -41,9 +53,28 @@ jobs:
NOTARIZATION_TEAM_ID: ${{ secrets.NOTARIZATION_TEAM_ID }}
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
needs: [ build_desktop_app ]
needs: [ build_desktop_and_ios_app ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -58,11 +89,6 @@ jobs:
distribution: 'temurin'
java-version: '17'

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

Expand Down Expand Up @@ -122,7 +148,7 @@ jobs:
./mifospay-desktop/build/compose/binaries/main-release/msi/*.msi
./mifospay-desktop/build/compose/binaries/main-release/deb/*.deb
./mifospay-desktop/build/compose/binaries/main-release/dmg/*.dmg
- name: ☁️ Deploy to Firebase
env:
Expand All @@ -135,9 +161,47 @@ jobs:
- name: Print `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/[email protected]
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:
name: Play Publish
runs-on: ubuntu-latest
if: ${{ inputs.publish_to_play_store == true }}
runs-on: macos-latest
concurrency:
group: playstore_deploy
permissions:
Expand All @@ -153,11 +217,18 @@ jobs:
distribution: 'temurin'
java-version: '17'

- uses: ruby/setup-ruby@v1
- name: Configure Ruby
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with:
ruby-version: '3.2'
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
uses: gradle/actions/setup-gradle@v4

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/make_site.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Publish Web App

on:
# Runs on pushes targeting the default branch
push:
pull_request:
branches: [ "dev" ]
types: [ closed ]
# Trigger on new releases
release:
types: [ published ]
types: [ released ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/release_to_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Production Deploy

on:
workflow_dispatch:
inputs:
publish_to_play_store:
required: false
default: false
description: Publish to Play Store?
type: boolean
release:
types: [ released ]

Expand All @@ -11,15 +17,21 @@ env:
jobs:
play_promote_production:
name: Play Publish Production
runs-on: ubuntu-latest
if: ${{ inputs.publish_to_play_store == true }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
- name: Configure Ruby
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with:
ruby-version: '3.2'
bundler-cache: true

- name: Install Bundler
run: |
gem install bundler:2.2.27
bundle install --jobs 4 --retry 3
- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
with:
Expand All @@ -29,4 +41,5 @@ jobs:
firebase-creds: ${{ secrets.FIREBASECREDS }}

- name: Promote Beta to Production Play Store
run: bundle exec fastlane promote_to_production
run: |
bundle exec fastlane promote_to_production
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ mifospay-shared/mifospay-shared.podspec
!/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml

# Gradle cache
.gradle

# Kotlin
.kotlin

Expand All @@ -62,12 +59,12 @@ app/app.iml
app/manifest-merger-release-report.txt

# Exclude Google services from prod flavour
mifospay/src/prod/google-services.json
mifospay-android/src/prod/google-services.json

#*.keystore

version.txt

fastlane/report.xml
firebaseAppDistributionServiceCredentialsFile.json
playStorePublishServiceCredentialsFile.json

Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.5
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source "https://rubygems.org"

ruby File.read(".ruby-version").strip

gem "fastlane"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
Expand Down
Loading

0 comments on commit 14703f6

Please sign in to comment.