7777
7878desc 'Release a new version'
7979lane :release do |options |
80- previous_version_number = last_git_tag
8180 artifacts_path = File . absolute_path ( '../StreamChatSwiftUIArtifacts.json' )
8281 extra_changes = lambda do |release_version |
8382 # Set the framework version on the artifacts
@@ -86,7 +85,9 @@ lane :release do |options|
8685 File . write ( artifacts_path , JSON . dump ( artifacts ) )
8786
8887 # Set the framework version in SystemEnvironment+Version.swift
89- new_content = File . read ( swift_environment_path ) . gsub! ( previous_version_number , release_version ) . gsub ( '-SNAPSHOT' , '' )
88+ old_content = File . read ( swift_environment_path )
89+ current_version = old_content [ /version: String = "([^"]+)"/ , 1 ]
90+ new_content = old_content . gsub ( current_version , release_version )
9091 File . open ( swift_environment_path , 'w' ) { |f | f . puts ( new_content ) }
9192
9293 # Update sdk sizes
@@ -112,11 +113,10 @@ end
112113
113114lane :merge_main do
114115 merge_main_to_develop
115- current_version = get_sdk_version_from_environment
116- add_snapshot_to_current_version ( file_path : swift_environment_path )
116+ update_release_version_to_snapshot ( file_path : swift_environment_path )
117117 ensure_git_branch ( branch : 'develop' )
118118 sh ( "git add #{ swift_environment_path } " )
119- sh ( "git commit -m 'Add snapshot postfix to v #{ current_version } '" )
119+ sh ( "git commit -m 'Update release version to snapshot '" )
120120 sh ( 'git push' )
121121end
122122
0 commit comments