-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec18c34
commit 399846c
Showing
5 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Pod::Spec.new do |spec| | ||
spec.name = "StreamChatSwiftUI-XCFramework" | ||
spec.version = "4.39.0" | ||
spec.summary = "StreamChat SwiftUI Chat Components" | ||
spec.description = "StreamChatSwiftUI SDK offers flexible SwiftUI components able to display data provided by StreamChat SDK." | ||
|
||
spec.homepage = "https://getstream.io/chat/" | ||
spec.license = { :type => "BSD-3", :file => "LICENSE" } | ||
spec.author = { "getstream.io" => "[email protected]" } | ||
spec.social_media_url = "https://getstream.io" | ||
spec.swift_version = '5.2' | ||
spec.platform = :ios, "14.0" | ||
spec.requires_arc = true | ||
|
||
spec.module_name = "StreamChatSwiftUI" | ||
spec.source = { :http => "https://github.com/GetStream/stream-chat-swiftui/releases/download/#{spec.version}/#{spec.module_name}.zip" } | ||
spec.vendored_frameworks = "#{spec.module_name}.xcframework" | ||
spec.preserve_paths = "#{spec.module_name}.xcframework/*" | ||
|
||
spec.framework = "Foundation", "UIKit", "SwiftUI" | ||
|
||
spec.dependency "StreamChat-XCFramework", "~> 4.39.0" | ||
|
||
spec.cocoapods_version = ">= 1.11.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,27 @@ after_all do |lane| | |
stop_sinatra if lane == :test_e2e_mock | ||
end | ||
|
||
lane :build_xcframeworks do | ||
match_me | ||
output_directory = "#{Dir.pwd}/../Products" | ||
team_id = File.read('Matchfile').match(/team_id\("(.*)"\)/)[1] | ||
codesign = ["codesign --timestamp -v --sign 'Apple Distribution: Stream.io Inc (#{team_id})'"] | ||
sdk_names.each do |sdk| | ||
create_xcframework( | ||
project: xcode_project, | ||
scheme: sdk, | ||
destinations: ['iOS'], | ||
include_BCSymbolMaps: true, | ||
include_debug_symbols: true, | ||
xcframework_output_directory: output_directory, | ||
remove_xcarchives: true | ||
) | ||
sh('../Scripts/removeUnneededSymbols.sh', sdk, output_directory) | ||
codesign << lane_context[SharedValues::XCFRAMEWORK_OUTPUT_PATH] | ||
end | ||
sh(codesign.join(' ')) # We need to sign all frameworks at once | ||
end | ||
|
||
desc 'Release a new version' | ||
lane :release do |options| | ||
pod_lint | ||
|
@@ -44,11 +65,20 @@ end | |
|
||
desc "Publish a new release to GitHub and CocoaPods" | ||
lane :publish_release do |options| | ||
clean_products | ||
build_xcframeworks | ||
compress_frameworks | ||
clean_products | ||
|
||
publish_ios_sdk( | ||
version: options[:version], | ||
sdk_names: sdk_names, | ||
github_repo: github_repo | ||
podspec_names: ['StreamChatSwiftUI', 'StreamChatSwiftUI-XCFramework'], | ||
github_repo: github_repo, | ||
upload_assets: ['Products/StreamChatSwiftUI.zip'] | ||
) | ||
|
||
update_spm(version: options[:version]) | ||
end | ||
|
||
private_lane :appstore_api_key do | ||
|
@@ -180,6 +210,79 @@ lane :build_demo do |options| | |
) | ||
end | ||
|
||
desc 'Cleans Products and DerivedData folders' | ||
lane :clean_products do | ||
Dir.chdir('..') do | ||
['*.xcframework', '*.bundle', '*.BCSymbolMaps', '*.dSYMs', 'LICENSE'].each do |f| | ||
sh("rm -rf Products/#{f}") | ||
end | ||
end | ||
end | ||
|
||
desc 'Update XCFrameworks and submit to the SPM repository' | ||
private_lane :update_spm do |options| | ||
version = options[:version] || '' | ||
UI.user_error!('You need to pass the version of the release you want to obtain the changelog from') unless version.length > 0 | ||
|
||
# Generate Checksums | ||
stream_chat_swiftui_checksum = sh('swift package compute-checksum ../Products/StreamChatSwiftUI.zip').strip | ||
|
||
# Update SPM Repo | ||
spm_directory_name = 'StreamSPM' | ||
spm_directory = "../../#{spm_directory_name}" | ||
sh("git clone [email protected]:#{github_repo}-spm.git ../../#{spm_directory_name}") | ||
|
||
Dir.chdir(spm_directory) do | ||
result = sh('basename `git rev-parse --show-toplevel`').strip | ||
UI.error("Not using #{spm_directory_name} repo") unless result.to_s == spm_directory_name | ||
|
||
file_lines = File.readlines('Package.swift') | ||
file_data = '' | ||
previous_module = '' | ||
|
||
file_lines.each do |line| | ||
formatted_line = | ||
case previous_module | ||
when "StreamChatSwiftUI" | ||
line.gsub(/(checksum: ")[a-z0-9]+(")/, "\\1#{stream_chat_swiftui_checksum}\\2") | ||
else | ||
line | ||
end | ||
|
||
url_pattern = %r{(releases/download/)[.0-9]+(/)} | ||
if line.match(url_pattern) | ||
formatted_line = line.gsub(url_pattern, "\\1#{version}\\2") | ||
previous_module = line.match(/([a-zA-Z]+).zip/).to_s.gsub(/.zip/, '') | ||
end | ||
|
||
file_data << formatted_line | ||
end | ||
|
||
# Write the new changes | ||
File.open('./Package.swift', 'w') { |file| file << file_data } | ||
|
||
# Update the repo | ||
sh('git add -A') | ||
sh("git commit -m 'Bump #{version}'") | ||
sh('git push') | ||
|
||
github_release = set_github_release( | ||
repository_name: "#{github_repo}-spm", | ||
api_token: ENV.fetch('GITHUB_TOKEN', nil), | ||
name: version, | ||
tag_name: version, | ||
commitish: 'main', | ||
description: "https://github.com/#{github_repo}/releases/tag/#{version}" | ||
) | ||
UI.success("New SPM release available: #{github_release['html_url']}") | ||
end | ||
|
||
# Clean Up | ||
sh("rm -rf #{spm_directory}") | ||
UI.success("New SPM release available: #{github_release['html_url']}") | ||
github_release['html_url'] | ||
end | ||
|
||
private_lane :update_testplan_on_ci do |options| | ||
update_testplan(path: options[:path], env_vars: { key: 'CI', value: 'TRUE' }) if is_ci | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters