@@ -57,64 +57,15 @@ platform :android do
5757 lane :distribute_to_s3 do |options |
5858 build_apk
5959
60- # Add logging to verify APK file availability
61- UI . message ( "🔍 Checking APK build outputs..." )
62-
63- # List contents of the build directory
64- build_dir = "#{ root_path } /build/app/outputs"
65- if Dir . exist? ( build_dir )
66- UI . message ( "📁 Contents of #{ build_dir } :" )
67- Dir . glob ( "#{ build_dir } /**/*" ) . each do |file |
68- UI . message ( " - #{ file } " )
69- end
70- else
71- UI . error ( "❌ Build directory does not exist: #{ build_dir } " )
72- end
73-
74- # Check specific APK locations
75- expected_apk = "#{ root_path } /build/app/outputs/apk/release/flutter-sample-app.apk"
76- actual_apk = "#{ root_path } /build/app/outputs/flutter-apk/app-release.apk"
77-
78- UI . message ( "🎯 Checking expected APK location: #{ expected_apk } " )
79- if File . exist? ( expected_apk )
80- UI . success ( "✅ Expected APK found!" )
81- file_size = File . size ( expected_apk ) / ( 1024 * 1024 ) # Size in MB
82- UI . message ( "📦 APK size: #{ file_size . round ( 1 ) } MB" )
83- else
84- UI . error ( "❌ Expected APK not found" )
85- end
86-
87- UI . message ( "🎯 Checking actual APK location: #{ actual_apk } " )
88- if File . exist? ( actual_apk )
89- UI . success ( "✅ Actual APK found!" )
90- file_size = File . size ( actual_apk ) / ( 1024 * 1024 ) # Size in MB
91- UI . message ( "📦 APK size: #{ file_size . round ( 1 ) } MB" )
92- else
93- UI . error ( "❌ Actual APK not found" )
94- end
95-
96- # Find all APK files
97- UI . message ( "🔎 Searching for all APK files in build directory..." )
98- apk_files = Dir . glob ( "#{ build_dir } /**/*.apk" )
99- if apk_files . any?
100- UI . message ( "📱 Found APK files:" )
101- apk_files . each do |apk |
102- file_size = File . size ( apk ) / ( 1024 * 1024 ) # Size in MB
103- UI . message ( " - #{ apk } (#{ file_size . round ( 1 ) } MB)" )
104- end
105- else
106- UI . error ( "❌ No APK files found in build directory!" )
107- end
108-
10960 bucket_with_path = ENV . fetch ( "AWS_S3_BUCKET" )
110- bucket_name , path = bucket_with_path . split ( '/' , 2 )
111-
61+ bucket_name , upload_path = bucket_with_path . chomp ( '/' ) . split ( '/' , 2 )
62+
11263 aws_s3 (
11364 access_key : ENV . fetch ( "AWS_ACCESS_KEY_ID" ) ,
11465 secret_access_key : ENV . fetch ( "AWS_SECRET_ACCESS_KEY" ) ,
11566 region : ENV . fetch ( "AWS_REGION" , "us-east-1" ) ,
11667 bucket : bucket_name ,
117- path : path ,
68+ path : upload_path ,
11869 acl : "private" ,
11970 server_side_encryption : "AES256" ,
12071 files : [ "#{ root_path } /build/app/outputs/apk/release/flutter-sample-app.apk" ]
0 commit comments