@@ -16,6 +16,7 @@ source_packages_path = 'spm_cache'
1616buildcache_xcargs = 'CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++'
1717is_localhost = !is_ci
1818project_package_resolved = "#{ xcode_project } /project.xcworkspace/xcshareddata/swiftpm/Package.resolved"
19+ swift_environment_path = File . absolute_path ( '../Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift' )
1920@force_check = false
2021
2122before_all do |lane |
@@ -67,7 +68,6 @@ desc 'Release a new version'
6768lane :release do |options |
6869 previous_version_number = last_git_tag
6970 artifacts_path = File . absolute_path ( '../StreamChatSwiftUIArtifacts.json' )
70- swift_environment_path = File . absolute_path ( '../Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift' )
7171 extra_changes = lambda do |release_version |
7272 # Set the framework version on the artifacts
7373 artifacts = JSON . parse ( File . read ( artifacts_path ) )
@@ -100,23 +100,27 @@ end
100100
101101desc "Publish a new release to GitHub and CocoaPods"
102102lane :publish_release do |options |
103- xcversion ( version : '15.0.1' )
103+ release_version = File . read ( swift_environment_path ) . match ( /String\s +=\s +"([\d .]+)"/ ) [ 1 ]
104+ UI . user_error! ( "Release #{ release_version } has already been published." ) if git_tag_exists ( tag : release_version , remote : true )
105+ UI . user_error! ( 'Release version cannot be empty' ) if release_version . to_s . empty?
106+ ensure_git_branch ( branch : 'main' )
104107
108+ xcversion ( version : '15.0.1' )
105109 clean_products
106110 build_xcframeworks
107111 compress_frameworks
108112 clean_products
109113
110114 publish_ios_sdk (
111115 skip_git_status_check : false ,
112- version : options [ :version ] ,
116+ version : release_version ,
113117 sdk_names : sdk_names ,
114118 podspec_names : [ 'StreamChatSwiftUI' , 'StreamChatSwiftUI-XCFramework' ] ,
115119 github_repo : github_repo ,
116120 upload_assets : [ 'Products/StreamChatSwiftUI.zip' ]
117121 )
118122
119- update_spm ( version : options [ :version ] )
123+ update_spm ( version : release_version )
120124
121125 merge_main_to_develop
122126end
0 commit comments