diff --git a/.github/actions/inflate-secrets/action.yml b/.github/actions/inflate-secrets/action.yml index 617bd9dca..d3a6714af 100644 --- a/.github/actions/inflate-secrets/action.yml +++ b/.github/actions/inflate-secrets/action.yml @@ -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 @@ -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 \ No newline at end of file + echo $FIREBASE_CREDS > mifospay-android/firebaseAppDistributionServiceCredentialsFile.json \ No newline at end of file diff --git a/.github/workflows/internal_or_beta_release.yml b/.github/workflows/internal_or_beta_release.yml index 2fcf1da91..efa249386 100644 --- a/.github/workflows/internal_or_beta_release.yml +++ b/.github/workflows/internal_or_beta_release.yml @@ -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: @@ -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 @@ -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 @@ -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: @@ -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/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: name: Play Publish - runs-on: ubuntu-latest + if: ${{ inputs.publish_to_play_store == true }} + runs-on: macos-latest concurrency: group: playstore_deploy permissions: @@ -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 diff --git a/.github/workflows/make_site.yaml b/.github/workflows/make_site.yaml index c9fc0852f..44fc02037 100644 --- a/.github/workflows/make_site.yaml +++ b/.github/workflows/make_site.yaml @@ -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: diff --git a/.github/workflows/release_to_production.yml b/.github/workflows/release_to_production.yml index c9360d923..305f1d173 100644 --- a/.github/workflows/release_to_production.yml +++ b/.github/workflows/release_to_production.yml @@ -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 ] @@ -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: @@ -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 diff --git a/.gitignore b/.gitignore index 829a53440..1f814a674 100644 --- a/.gitignore +++ b/.gitignore @@ -48,9 +48,6 @@ mifospay-shared/mifospay-shared.podspec !/.idea/codeStyles/Project.xml !/.idea/codeStyles/codeStyleConfig.xml -# Gradle cache -.gradle - # Kotlin .kotlin @@ -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 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..0163af7e8 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.5 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 1e4d11c03..205f1c3a3 100644 --- a/Gemfile +++ b/Gemfile @@ -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') diff --git a/Gemfile.lock b/Gemfile.lock index 965cf8985..b980c483d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,20 +10,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.971.0) - aws-sdk-core (3.203.0) + aws-partitions (1.1013.0) + aws-sdk-core (3.214.0) aws-eventstream (~> 1, >= 1.3.0) - aws-partitions (~> 1, >= 1.651.0) + aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.89.0) - aws-sdk-core (~> 3, >= 3.203.0) + aws-sdk-kms (1.96.0) + aws-sdk-core (~> 3, >= 3.210.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.160.0) - aws-sdk-core (~> 3, >= 3.203.0) + aws-sdk-s3 (1.174.0) + aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.1) + aws-sigv4 (1.10.1) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -38,8 +38,8 @@ GEM domain_name (0.6.20240107) dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.111.0) - faraday (1.10.3) + excon (0.112.0) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -65,10 +65,10 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.222.0) + fastlane (2.225.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -84,6 +84,7 @@ GEM faraday-cookie_jar (~> 0.0.6) faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) @@ -109,7 +110,12 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.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) google-apis-androidpublisher_v3 (0.54.0) google-apis-core (>= 0.11.0, < 2.a) @@ -121,6 +127,10 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.a) 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-core (>= 0.11.0, < 2.a) google-apis-playcustomapp_v1 (0.13.0) @@ -152,17 +162,17 @@ GEM domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.2) - json (2.7.2) - jwt (2.8.2) + json (2.8.2) + jwt (2.9.3) base64 mini_magick (4.13.2) mini_mime (1.1.5) multi_json (1.15.0) multipart-post (2.4.1) - nanaimo (0.3.0) + nanaimo (0.4.0) naturally (2.2.1) nkf (0.2.0) - optparse (0.5.0) + optparse (0.6.0) os (1.1.4) plist (3.7.1) public_suffix (6.0.1) @@ -172,7 +182,7 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.3.7) + rexml (3.3.9) rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -185,6 +195,7 @@ GEM simctl (1.6.10) CFPropertyList naturally + sysrandom (1.0.5) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -194,29 +205,31 @@ GEM tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) - xcodeproj (1.25.0) + xcodeproj (1.27.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.3.0) - rexml (>= 3.3.2, < 4.0) + nanaimo (~> 0.4.0) + rexml (>= 3.3.6, < 4.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) PLATFORMS - arm64-darwin-22 + ruby x64-mingw-ucrt - x86_64-linux - DEPENDENCIES fastlane - fastlane-plugin-increment_version_code + fastlane-plugin-firebase_app_distribution + fastlane-plugin-increment_build_number + +RUBY VERSION + ruby 3.3.5p100 BUNDLED WITH - 2.5.18 + 2.5.23 diff --git a/fastlane/FastFile b/fastlane/FastFile index 4dd5b1c91..b93ef81a3 100644 --- a/fastlane/FastFile +++ b/fastlane/FastFile @@ -34,4 +34,38 @@ platform :android do ) end -end \ No newline at end of file +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 diff --git a/fastlane/PluginFile b/fastlane/PluginFile index 32ea0b1fb..c3f69f2b0 100644 --- a/fastlane/PluginFile +++ b/fastlane/PluginFile @@ -1,5 +1,5 @@ # Autogenerated by fastlane # # Ensure this file is checked in to source control! - -gem 'fastlane-plugin-increment_version_code' \ No newline at end of file +gem 'fastlane-plugin-firebase_app_distribution' +gem 'fastlane-plugin-increment_build_number' diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 000000000..60dee619b --- /dev/null +++ b/fastlane/README.md @@ -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). diff --git a/fastlane/report.xml b/fastlane/report.xml new file mode 100644 index 000000000..b27157959 --- /dev/null +++ b/fastlane/report.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/mifospay-android/build.gradle.kts b/mifospay-android/build.gradle.kts index d89c9c714..440124dca 100644 --- a/mifospay-android/build.gradle.kts +++ b/mifospay-android/build.gradle.kts @@ -86,6 +86,12 @@ android { isIncludeAndroidResources = true } } + + firebaseAppDistribution { + serviceCredentialsFile = "mifospay-android/firebaseAppDistributionServiceCredentialsFile.json" + releaseNotesFile = "mifospay-android/build/outputs/changelogBeta" + groups = "mifos-wallet-testers" + } } 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. configure { disableVersionCheck = true