Skip to content

Commit 4c3130b

Browse files
committed
Update release script
1 parent d62c4c4 commit 4c3130b

File tree

5 files changed

+85
-44
lines changed

5 files changed

+85
-44
lines changed

Gemfile.lock

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ GEM
107107
xcodeproj (>= 1.13.0, < 2.0.0)
108108
xcpretty (~> 0.3.0)
109109
xcpretty-travis-formatter (>= 0.0.3)
110+
fastlane-plugin-stream_actions (0.3.76)
111+
xctest_list (= 1.2.1)
110112
gh_inspector (1.1.3)
111113
google-apis-androidpublisher_v3 (0.50.0)
112114
google-apis-core (>= 0.11.0, < 2.a)
@@ -232,13 +234,15 @@ GEM
232234
rouge (~> 2.0.7)
233235
xcpretty-travis-formatter (1.0.1)
234236
xcpretty (~> 0.2, >= 0.0.7)
237+
xctest_list (1.2.1)
235238

236239
PLATFORMS
237240
arm64-darwin-21
238241
arm64-darwin-23
239242

240243
DEPENDENCIES
241244
fastlane
245+
fastlane-plugin-stream_actions (= 0.3.76)
242246
json
243247
plist
244248
rubocop (= 1.38)

Package.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
import PackageDescription
33

44
let package = Package(
5-
name: "StreamWebRTC",
5+
name: "WebRTC",
66
platforms: [
77
.iOS(.v13),
88
.macOS(.v11)
99
],
1010
products: [
1111
.library(
12-
name: "StreamWebRTC",
13-
targets: ["StreamWebRTC"]
12+
name: "WebRTC",
13+
targets: ["WebRTC"]
1414
),
1515
],
1616
dependencies: [ ],
1717
targets: [
1818
.binaryTarget(
19-
name: "StreamWebRTC",
20-
url: "https://github.com/GetStream/stream-video-swift-webrtc/releases/download/125.6422.06/StreamWebRTC.zip",
19+
name: "WebRTC",
20+
url: "https://github.com/GetStream/stream-video-swift-webrtc/releases/download/125.6422.06/WebRTC.zip",
2121
checksum: "c3b690ec04727cf5510aeb073fc24156b74a074293a66d39be0a5c2570df1422"
2222
),
2323
]

WebRTC.podspec

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = "WebRTC"
3+
spec.version = "125.6422.06"
4+
spec.summary = "Stream WebRTC"
5+
spec.description = spec.summary
6+
7+
spec.homepage = "https://getstream.io/video/"
8+
spec.license = { type: "BSD-3", file: "LICENSE" }
9+
spec.author = { "getstream.io" => "[email protected]" }
10+
spec.social_media_url = "https://getstream.io"
11+
12+
spec.ios.deployment_target = '13.0'
13+
14+
spec.source = { http: "https://github.com/GetStream/stream-video-swift-webrtc/releases/download/#{spec.version}/WebRTC.xcframework.zip" }
15+
spec.vendored_frameworks = "WebRTC.xcframework"
16+
end

fastlane/Fastfile

+55-39
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ skip_docs
44
require 'json'
55
require 'net/http'
66

7-
old_name = 'WebRTC'
8-
new_name = 'StreamWebRTC'
7+
github_repo = ENV['GITHUB_REPOSITORY'] || 'GetStream/stream-video-swift-webrtc'
8+
sdk_name = 'WebRTC'
9+
modified_sdk_name = 'StreamWebRTC'
910
swift_package_path = '../Package.swift'
11+
podspec_path = 'WebRTC.podspec'
1012

1113
lane :release do |options|
14+
UI.user_error!("You must specify an xcframework path or livekit option") if options[:xcframework_path].nil? && options[:livekit].nil?
1215
UI.user_error!("You must specify an xcframework version") unless options[:version]
1316
UI.user_error!("Tag for version #{options[:version]} already exists!") if git_tag_exists(tag: options[:version])
1417
UI.success("Ignore the red warning above. Tag for version #{options[:version]} is alright!")
@@ -17,11 +20,20 @@ lane :release do |options|
1720
sh("rm -rf *.xcframework")
1821

1922
code_review
20-
download_framework(version: options[:version])
21-
rename_framework
2223

23-
sh("ditto -c -k --sequesterRsrc --keepParent #{new_name}.xcframework #{new_name}.zip")
24-
checksum = sh("swift package compute-checksum #{new_name}.zip").strip
24+
options[:xcframework_path] = download_framework(version: options[:version]) if options[:livekit]
25+
26+
options[:xcframework_path] = unzip_xcframework(file_path: options[:xcframework_path])
27+
28+
options[:xcframework_path] = rename_framework if options[:livekit]
29+
30+
sign_xcframework(file_path: options[:xcframework_path])
31+
32+
options[:xcframework_path] = zip_xcframework(file_path: options[:xcframework_path])
33+
34+
checksum = sh("swift package compute-checksum #{options[:xcframework_path]}").strip
35+
36+
version_bump_podspec(path: podspec_path, version_number: options[:version])
2537

2638
file_data = ''
2739
File.readlines(swift_package_path).each do |line|
@@ -48,33 +60,28 @@ lane :release do |options|
4860
UI.user_error!("Not pushing changes") unless prompt(text: "Will push changes. All looking good?", boolean: true)
4961
sh('git push')
5062

51-
github_release = set_github_release(
52-
repository_name: 'GetStream/stream-video-swift-webrtc',
53-
api_token: ENV.fetch("GITHUB_TOKEN", nil),
54-
name: options[:version].to_s,
55-
tag_name: options[:version].to_s,
56-
description: "Upgrade to WebRTC-SDK v#{options[:version]}\n\nChecksum: #{checksum}",
57-
commitish: git_branch,
58-
upload_assets: ["fastlane/#{new_name}.zip"]
63+
publish_ios_sdk(
64+
github_repo: github_repo,
65+
sdk_names: [sdk_name],
66+
version: options[:version],
67+
changelog: "Upgrade to WebRTC v#{options[:version]}\n\nChecksum: #{checksum}",
68+
upload_assets: "fastlane/#{options[:xcframework_path]}"
5969
)
60-
61-
UI.success("New SPM release available: #{github_release['html_url']}")
6270
end
6371

64-
desc 'Example: bundle exec fastlane rename_framework path:WebRTC.xcframework'
65-
private_lane :rename_framework do |options|
66-
old_framework_path = File.expand_path("#{old_name}.xcframework")
67-
new_framework_path = old_framework_path.gsub(/#{old_name}/, new_name)
72+
private_lane :rename_framework do
73+
old_framework_path = File.expand_path("#{sdk_name}.xcframework")
74+
new_framework_path = old_framework_path.gsub(/#{sdk_name}/, modified_sdk_name)
6875

6976
# Rename the framework itself
7077
File.rename(old_framework_path, new_framework_path)
7178

7279
# Rename all files with the old framework name with the new one
73-
["#{old_name}.framework", "#{old_name}.h", old_name].each do |file_name|
80+
["#{sdk_name}.framework", "#{sdk_name}.h", sdk_name].each do |file_name|
7481
Dir.glob("#{new_framework_path}/**/*").each do |old_file_path|
7582
next unless File.basename(old_file_path) == file_name
7683

77-
new_file_path = old_file_path.reverse.sub(old_name.reverse, new_name.reverse).reverse
84+
new_file_path = old_file_path.reverse.sub(sdk_name.reverse, modified_sdk_name.reverse).reverse
7885
File.rename(old_file_path, new_file_path)
7986
end
8087
end
@@ -83,50 +90,59 @@ private_lane :rename_framework do |options|
8390
Dir.glob(["#{new_framework_path}/**/Info.plist", "#{new_framework_path}/**/module.modulemap"]).each do |file|
8491
sh("plutil -convert xml1 #{file}") if file.include?('Info.plist')
8592
old_text = File.read(file)
86-
new_text = old_text.gsub(/#{old_name}/, new_name)
93+
new_text = old_text.gsub(/#{sdk_name}/, modified_sdk_name)
8794
File.open(file, 'w') { |f| f.puts(new_text) } if old_text != new_text
8895
end
8996

9097
# Replace all imports of the old framework with the new one
9198
Dir.glob("#{new_framework_path}/**/*.h").each do |file|
9299
old_text = File.read(file)
93-
new_text = old_text.gsub(/import <#{old_name}/, "import <#{new_name}")
100+
new_text = old_text.gsub(/import <#{sdk_name}/, "import <#{modified_sdk_name}")
94101
File.open(file, 'w') { |f| f.puts(new_text) } if old_text != new_text
95102
end
96103

97104
# Rename the rpath for all the frameworks and update symlinks if required
98105
framework_paths = new_framework_path.include?('.xcframework') ? Dir.glob("#{new_framework_path}/**/*.framework") : [new_framework_path]
99106
framework_paths.each do |path|
100107
Dir.chdir(path) do
101-
if File.symlink?(new_name)
102-
old_symlink = File.readlink(new_name)
103-
new_symlink = old_symlink.reverse.sub(old_name.reverse, new_name.reverse).reverse
108+
if File.symlink?(modified_sdk_name)
109+
old_symlink = File.readlink(modified_sdk_name)
110+
new_symlink = old_symlink.reverse.sub(sdk_name.reverse, modified_sdk_name.reverse).reverse
104111

105-
File.delete(new_name)
106-
File.symlink(new_symlink, new_name)
112+
File.delete(modified_sdk_name)
113+
File.symlink(new_symlink, modified_sdk_name)
107114
end
108115

109-
sh("install_name_tool -id @rpath/#{new_name}.framework/#{new_name} #{new_name}")
116+
sh("install_name_tool -id @rpath/#{modified_sdk_name}.framework/#{modified_sdk_name} #{modified_sdk_name}")
110117
end
111118
end
119+
new_framework_path
120+
end
112121

113-
# Sign xcframework if required
114-
if new_framework_path.include?('.xcframework')
115-
team_id = File.read('Matchfile').match(/team_id\("(.*)"\)/)[1]
116-
sh("codesign --force --timestamp -v --sign 'Apple Distribution: Stream.io Inc (#{team_id})' #{new_framework_path}")
117-
end
122+
private_lane :sign_xcframework do |options|
123+
team_id = File.read('Matchfile').match(/team_id\("(.*)"\)/)[1]
124+
sh("codesign --force --timestamp -v --sign 'Apple Distribution: Stream.io Inc (#{team_id})' #{options[:file_path]}")
118125
end
119126

120127
private_lane :download_framework do |options|
121128
UI.user_error!("You must specify an xcframework version") unless options[:version]
122129

123-
url = "https://github.com/webrtc-sdk/Specs/releases/download/#{options[:version]}/#{old_name}.xcframework.zip"
124-
local_file_path = "#{old_name}.xcframework.zip"
130+
url = "https://github.com/webrtc-sdk/Specs/releases/download/#{options[:version]}/#{sdk_name}.xcframework.zip"
131+
local_file_path = "#{sdk_name}.xcframework.zip"
125132

126133
sh("wget '#{url}' -O '#{local_file_path}'")
134+
local_file_path
135+
end
136+
137+
private_lane :unzip_xcframework do |options|
138+
sh("unzip '#{options[:file_path]}'")
139+
File.basename(options[:file_path]).gsub('.zip', '')
140+
end
127141

128-
# Extract the contents of the zip file
129-
sh("unzip '#{local_file_path}'")
142+
private_lane :zip_xcframework do |options|
143+
zip_name = "#{options[:file_path]}.zip"
144+
sh("ditto -c -k --sequesterRsrc --keepParent #{options[:file_path]} #{zip_name}")
145+
zip_name
130146
end
131147

132148
lane :code_review do

fastlane/Pluginfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
gem 'fastlane-plugin-stream_actions', '0.3.76'

0 commit comments

Comments
 (0)