Skip to content

Commit 194eea5

Browse files
[CI] Create a lane to update StreamChat dependency (#687)
1 parent 91e4619 commit 194eea5

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let package = Package(
1616
)
1717
],
1818
dependencies: [
19-
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.67.0"),
19+
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.68.0"),
2020
],
2121
targets: [
2222
.target(

fastlane/Fastfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,40 @@ private_lane :appstore_api_key do
146146
)
147147
end
148148

149+
desc "Updates StreamChat dependency locally. Usage: `bundle exec fastlane update_stream_chat version:4.56.0`"
150+
lane :update_stream_chat do |options|
151+
raise UI.user_error!('Provide a version.') unless options[:version]
152+
153+
Dir.chdir('..') do
154+
file = 'Package.swift'
155+
current_stream_chat_version = File.read(file)[/stream-chat-swift\.git", from: "([\d.]+)"\)/, 1]
156+
File.write(file, File.read(file).gsub(/(stream-chat-swift\.git", from: ")[\d.]+"/, "\\1#{options[:version]}\""))
157+
158+
file = 'StreamChatSwiftUI-XCFramework.podspec'
159+
File.write(file, File.read(file).gsub(/(StreamChat-XCFramework', '~> )[\d.]+'/, "\\1#{options[:version]}'"))
160+
161+
file = 'StreamChatSwiftUI.podspec'
162+
File.write(file, File.read(file).gsub(/(StreamChat', '~> )[\d.]+'/, "\\1#{options[:version]}'"))
163+
164+
file = 'StreamChatSwiftUI.xcodeproj/project.pbxproj'
165+
content = File.read(file)
166+
if content.include?("minimumVersion = #{current_stream_chat_version}")
167+
File.write(file, content.gsub("minimumVersion = #{current_stream_chat_version}", "minimumVersion = #{options[:version]}"))
168+
elsif content.include?('branch = develop')
169+
File.write(file, content.gsub('kind = branch', "minimumVersion = #{options[:version]}").gsub('branch = develop', 'kind = upToNextMajorVersion'))
170+
else
171+
UI.user_error!("Something went wrong after trying to modify #{file}.")
172+
end
173+
end
174+
175+
pr_create(
176+
title: "Update StreamChat dependency to #{options[:version]}",
177+
base_branch: 'develop',
178+
head_branch: "ci/update-stream-chat-dependency-#{Time.now.to_i}",
179+
github_repo: github_repo
180+
)
181+
end
182+
149183
lane :pod_lint do
150184
lint_required = true
151185
Dir.chdir('..') do

0 commit comments

Comments
 (0)