@@ -495,13 +495,16 @@ lane :show_frameworks_sizes do |options|
495495 [ 'metrics/' ] . each { |dir | FileUtils . remove_dir ( dir , force : true ) }
496496
497497 sh ( "git clone #{ metrics_git } #{ File . dirname ( sdk_size_path ) } " )
498- develop_sizes = JSON . parse ( File . read ( sdk_size_path ) )
498+ is_release = current_branch . include? ( 'release/' )
499+ benchmark_config = JSON . parse ( File . read ( sdk_size_path ) )
500+ benchmark_key = is_release ? 'release' : 'develop'
501+ benchmark_sizes = benchmark_config [ benchmark_key ]
499502 branch_sizes = options [ :sizes ] || frameworks_sizes
500503
501504 table_header = '## SDK Size'
502- markdown_table = "#{ table_header } \n | `title` | `develop` | `branch` | `diff` | `status` |\n | - | - | - | - | - |\n "
505+ markdown_table = "#{ table_header } \n | `title` | `#{ is_release ? 'previous release' : ' develop' } ` | `#{ is_release ? 'current release' : ' branch' } ` | `diff` | `status` |\n | - | - | - | - | - |\n "
503506 sdk_names . each do |title |
504- benchmark_value = develop_sizes [ title ]
507+ benchmark_value = benchmark_sizes [ title ]
505508 branch_value = branch_sizes [ title . to_sym ]
506509 max_tolerance = 0.5 # Max Tolerance is 0.5MB
507510 fine_tolerance = 0.25 # Fine Tolerance is 0.25MB
@@ -522,12 +525,13 @@ lane :show_frameworks_sizes do |options|
522525 markdown_table << "|#{ title } |#{ benchmark_value } MB|#{ branch_value } MB|#{ diff } MB|#{ status_emoji } |\n "
523526 end
524527
525- FastlaneCore ::PrintTable . print_values ( title : 'Benchmark' , config : develop_sizes )
528+ FastlaneCore ::PrintTable . print_values ( title : 'Benchmark' , config : benchmark_sizes )
526529 FastlaneCore ::PrintTable . print_values ( title : 'SDK Size' , config : branch_sizes )
527530
528531 if is_ci
529- if ENV [ 'GITHUB_EVENT_NAME' ] . to_s == 'push'
530- File . write ( sdk_size_path , JSON . pretty_generate ( branch_sizes ) )
532+ if is_release || ENV [ 'GITHUB_EVENT_NAME' ] . to_s == 'push'
533+ benchmark_config [ benchmark_key ] = branch_sizes
534+ File . write ( sdk_size_path , JSON . pretty_generate ( benchmark_config ) )
531535 Dir . chdir ( File . dirname ( sdk_size_path ) ) do
532536 if sh ( 'git status -s' , log : false ) . to_s . empty?
533537 UI . important ( 'No changes in SDK sizes benchmarks.' )
0 commit comments