@@ -9,6 +9,7 @@ import 'Allurefile'
99
1010xcode_version = ENV [ 'XCODE_VERSION' ] || '14.2'
1111xcode_project = 'StreamChatSwiftUI.xcodeproj'
12+ sdk_names = [ 'StreamChatSwiftUI' ]
1213github_repo = ENV [ 'GITHUB_REPOSITORY' ] || 'GetStream/stream-chat-swiftui'
1314
1415before_all do
2526
2627desc 'Release a new version'
2728lane :release do |options |
28- ensure_git_branch ( branch : 'main' ) # We can only release on default branch
29- ensure_git_status_clean unless options [ :no_ensure_clean ]
30-
31- UI . user_error! ( 'Please set GITHUB_TOKEN environment value. See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token' ) if ENV [ 'GITHUB_TOKEN' ] . nil?
32-
33- if options [ :version ] . nil? # User passed a version, use it
34- UI . user_error! ( 'Please use type parameter with one of the options: type:patch, type:minor, type:major' ) unless [ 'patch' , 'minor' , 'major' ] . include? ( options [ :type ] )
35- version_number = increment_version_number_in_plist ( bump_type : options [ :type ] , xcodeproj : xcode_project , target : 'StreamChatSwiftUI' )
36- else
37- version_number = options . fetch ( :version )
38- increment_version_number_in_plist ( version_number : version_number , xcodeproj : xcode_project , target : 'StreamChatSwiftUI' )
39- end
40-
41- UI . user_error! ( "Tag for version #{ version_number } already exists!" ) if git_tag_exists ( tag : version_number )
42-
43- changes = touch_changelog ( release_version : version_number , github_repo : github_repo )
44-
45- podspec = 'StreamChatSwiftUI.podspec'
46- pod_lib_lint ( podspec : podspec , allow_warnings : true )
47- version_bump_podspec ( path : podspec , version_number : version_number )
48-
49- sh ( 'git add -A' )
50-
51- UI . user_error! ( 'Not committing changes' ) unless prompt ( text : 'Will commit changes. All looking good?' , boolean : true )
52-
53- sh ( "git commit -m 'Bump #{ version_number } '" )
54- sh ( "git tag #{ version_number } " )
55-
56- UI . user_error! ( 'Not pushing changes' ) unless prompt ( text : 'Will push changes. All looking good?' , boolean : true )
57-
58- push_to_git_remote ( tags : true )
59-
60- github_release = set_github_release (
61- repository_name : github_repo ,
62- api_token : ENV . fetch ( 'GITHUB_TOKEN' , nil ) ,
63- name : version_number ,
64- tag_name : version_number ,
65- description : changes
29+ version_number = release_ios_sdk (
30+ version : options [ :version ] ,
31+ bump_type : options [ :type ] ,
32+ sdk_names : sdk_names ,
33+ github_repo : github_repo
6634 )
35+ publish_release ( version : version_number )
36+ end
6737
68- pod_push ( path : podspec , allow_warnings : true )
69-
70- UI . success ( "Successfully released #{ version_number } " )
71- UI . success ( "Github release was created, please visit #{ github_release [ 'url' ] } to see it" )
38+ desc "Publish a new release to GitHub and CocoaPods"
39+ lane :publish_release do |options |
40+ publish_ios_sdk (
41+ version : options [ :version ] ,
42+ sdk_names : sdk_names ,
43+ github_repo : github_repo
44+ )
7245end
7346
7447private_lane :appstore_api_key do
0 commit comments