Skip to content

Commit 2a63ee4

Browse files
[CI] Automatically update SDK size badges in README.md (#562)
1 parent ce6becb commit 2a63ee4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
<p align="center">
66
<a href="https://sonarcloud.io/summary/new_code?id=GetStream_stream-chat-swiftui"><img src="https://sonarcloud.io/api/project_badges/measure?project=GetStream_stream-chat-swiftui&metric=coverage" /></a>
7+
8+
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-6.96MB-blue"/>
79
</p>
810

911
## SwiftUI StreamChat SDK

fastlane/Fastfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
543546
end
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+
545569
def frameworks_sizes
546570
root_dir = 'Build/SDKSize'
547571
archive_dir = "#{root_dir}/DemoApp.xcarchive"

0 commit comments

Comments
 (0)