From fc615843b53c58cd410f572678f644950d0c5792 Mon Sep 17 00:00:00 2001 From: Krishna Prasad N <krishna.prasad@niveussolutions.com> Date: Wed, 7 Feb 2024 12:23:33 +0530 Subject: [PATCH] Minor changes in jenkins and fastlane file, updated the app version --- Jenkinsfile | 25 ++++++++----------------- app/build.gradle.kts | 4 ++-- fastlane/Fastfile | 36 +++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 159e545..76a2158 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,29 +10,21 @@ pipeline { } stages { - /* stage('Build') { + // STAGE 1 - Build the application + stage('Build') { steps { - script { - // Your initial build steps here - echo 'Building...' - } - } - } - - stage('upload to drive') { - steps { script { // Use absolute path to Fastlane def fastlanePath = '/home/karthik_shetty_niveussolutions_c/usr/local/bin/fastlane' env.PATH = "${fastlanePath}:${env.PATH}" // Run Fastlane deploy for Firebase App distribution - sh 'sudo fastlane deployToDrive' + sh 'fastlane build' } - } - - } */ - + } + } + + // STAGE 2 - Upload the build to Firebase App Distribution Channel stage('Firebase App Distribution') { steps { script { @@ -46,6 +38,7 @@ pipeline { } } + // STAGE 3 - Upload the build to Google Playstore Alpha Track stage('Playstore Alpha Testing') { steps { script { @@ -61,8 +54,6 @@ pipeline { } - - post { always { // Clean up steps if needed diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a473a66..366b428 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,8 +21,8 @@ android { applicationId = "com.kp.testapp" minSdk = 25 targetSdk = 34 - versionCode = 2 - versionName = "1.0.1" + versionCode = 3 + versionName = "1.0.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 061ce8a..b41174f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -16,18 +16,25 @@ default_platform(:android) platform :android do + # get the required prerequisites like credentials, app ids etc. before_all do ENV["FIREBASE_LOGIN_CREDENTIALS"] = "fastlane/fastlane-admin-app-distribution.json" ENV["FIREBASE_APP_ID"] = "1:771295755070:android:5007592bd3aba1c3ec0a6f" end - ######## FIREBASE DISTRIBUTION ######## - desc "Submit a new Google Test Build to Firebase App Distribution" + ######## Generate the Apk and App bundle ######## + desc "build the apk or bundle" + lane :build do + gradle(task: "clean assembleDebug") # generates debug build + gradle(task: "bundleRelease") # generates signed release bundle + end + + + ######## Upload apk to Firebase Distribution Channel ######## + desc "Upload build to Firebase App Distribution" lane :distributeViaFirebase do |options| - #gradle(task: "bundleRelease") - gradle(task: "clean assembleDebug") + #gradle(task: "clean assembleDebug") - #apk_path = "app/build/outputs/bundle/release/app-release.aab" apk_path = "app/build/outputs/apk/debug/app-debug.apk" firebase_app_distribution( @@ -39,24 +46,19 @@ platform :android do ) end - desc "build the apk" - lane :build do - gradle(task: "bundleRelease") - #gradle(task: "clean assembleDebug") - # gradle(task: "clean assembleRelease") - end + ######## Upload app bundle to Google Playstore Alpha Track ######## + desc "Deploy a new version to the Google Play Store - Alpha Track" + lane :deployToPlaystoreAlpha do + #gradle(task: "bundleRelease") - desc "Deploy a new version to the Google Play - Alpha" - lane :deployToPlaystoreAlpha do - gradle(task: "bundleRelease") - upload_to_play_store( - track: "alpha", + upload_to_play_store( + track: "alpha", # alpha or beta or internal or production json_key: "/home/karthik_shetty_niveussolutions_c/prj-common-services-01-0c9b948542c2.json", package_name: "com.kp.testapp", aab: "app/build/outputs/bundle/release/app-release.aab", skip_upload_metadata: true, # Set to false if you want to upload metadata (e.g., changelog) skip_upload_images: true, # Set to false if you want to upload screenshots, feature graphics, etc. - skip_upload_apk: true + skip_upload_apk: true # Set to true if opting for App Bundle ) end -- GitLab