@@ -83,6 +83,9 @@ lane :release do |options|
8383 # Set the framework version in SystemEnvironment+Version.swift
8484 new_content = File . read ( swift_environment_path ) . gsub! ( previous_version_number , release_version )
8585 File . open ( swift_environment_path , 'w' ) { |f | f . puts ( new_content ) }
86+
87+ # Update sdk sizes
88+ Dir . chdir ( 'fastlane' ) { update_img_shields_sdk_sizes }
8689 end
8790
8891 pod_lint
@@ -542,6 +545,27 @@ lane :show_frameworks_sizes do |options|
542545 UI . user_error! ( "#{ table_header } benchmark failed." ) if markdown_table . include? ( fail_status )
543546end
544547
548+ desc 'Update img shields SDK size labels'
549+ lane :update_img_shields_sdk_sizes do
550+ sizes = frameworks_sizes
551+
552+ # Read the file into a string
553+ readme_path = '../README.md'
554+ readme_content = File . read ( readme_path )
555+
556+ # Define the new value for the badge
557+ stream_chat_swiftui_size = "#{ sizes [ :StreamChatSwiftUI ] } MB"
558+
559+ # Replace the value in the badge URL
560+ readme_content . gsub! ( %r{(https://img.shields.io/badge/StreamChatSwiftUI-)(.*?)(-blue)} , "\\ 1#{ stream_chat_swiftui_size } \\ 3" )
561+
562+ # Write the updated content back to the file
563+ File . write ( readme_path , readme_content )
564+
565+ # Notify success
566+ UI . success ( 'Successfully updated the SDK size labels in README.md!' )
567+ end
568+
545569def frameworks_sizes
546570 root_dir = 'Build/SDKSize'
547571 archive_dir = "#{ root_dir } /DemoApp.xcarchive"
0 commit comments