-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathFastfile
236 lines (205 loc) · 6.81 KB
/
Fastfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
#update_fastlane
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.102.0"
default_platform :ios
# xcode_select("/Applications/Xcode-beta.app")
def app_vers
File.read('../build-scripts/VERSION').split('\n')[0].strip
end
platform :ios do
desc "Check all certs and provisioning profiles from github"
lane :certs do
app_root = "com.irccloud."
for type in ["development"] do
match(type: type, app_identifier: [
"#{app_root}IRCCloud",
"#{app_root}IRCCloud.ShareExtension",
"#{app_root}IRCCloud.NotificationService",
"#{app_root}enterprise",
"#{app_root}enterprise.ShareExtension",
"#{app_root}enterprise.NotificationService"
])
end
end
desc "Generate new push certs"
lane :apn do |options|
if options[:enterprise]
bundle_id = "com.irccloud.enterprise"
else
bundle_id = "com.irccloud.IRCCloud"
end
get_push_certificate(
generate_p12: false,
app_identifier: bundle_id
)
end
desc "Upload symbols to FirebaseCrashlytics"
lane :upload_symbols do |options|
sh "cd .. && pods/FirebaseCrashlytics/upload-symbols -gsp IRCCloud/GoogleService-Info.plist -p ios IRCCloud.app.dSYM.zip"
end
desc "Build and push to iTunes Connect"
lane :push do |options|
if options[:enterprise]
ipa = "IRCEnterprise.ipa"
scheme = "IRCCloud Enterprise"
bundle_id = "com.irccloud.enterprise"
profile_root = "App Store Enterprise"
else
ipa = "IRCCloud.ipa"
scheme = "IRCCloud"
bundle_id = "com.irccloud.IRCCloud"
profile_root = "App Store"
end
# Set a build number manually if provided
# TODO pull this from the Info.plist
default_build_number = "GIT_VERSION"
if options[:build]
sh "cd .. && agvtool new-version -all #{options[:build]}"
end
# Install CocoaPods
cocoapods(podfile: "./Podfile")
# Build an ipa
gym(
scheme: scheme,
configuration: "AppStore",
export_method: "app-store",
export_options: {
method: "app-store",
provisioningProfiles: {
"#{bundle_id}" => "#{profile_root}",
"#{bundle_id}.ShareExtension" => "#{profile_root} ShareExtension",
"#{bundle_id}.NotificationService" => "#{profile_root} NotificationService",
}
}
)
# Reset the build number
if options[:build]
sh "cd .. && agvtool new-version -all #{default_build_number}"
end
# Upload to iTunes Connect
deliver(
ipa: ipa,
skip_metadata: true,
skip_screenshots: true
)
sh "cd .. && pods/FirebaseCrashlytics/upload-symbols -gsp IRCCloud/GoogleService-Info.plist -p ios IRCCloud.app.dSYM.zip"
end
desc "Print version"
lane :vers do
UI.success "Version: #{app_vers()}"
end
desc "Take screenshots"
lane :screenshots do
snapshot(
clear_previous_screenshots: true,
skip_open_summary: true,
clean: true,
derived_data_path: "./build",
devices: ["iPhone X", "iPhone 6s Plus", "iPhone 13 Pro Max"],
ios_version: "12.2",
launch_arguments: ["-bigphone YES"]
)
snapshot(
clear_previous_screenshots: false,
skip_open_summary: true,
derived_data_path: "./build",
test_without_building: true,
devices: [
"iPhone 5s",
"iPhone 6s",
"iPad Pro (9.7-inch)",
"iPad Pro (10.5-inch)",
"iPad Pro (11-inch)",
"iPad Pro (12.9-inch) (2nd generation)"
],
ios_version: "12.2"
)
frameit()
notification(
subtitle: "screenshots",
message: "iOS screenshots complete",
activate: "com.googlecode.iterm2"
)
end
desc "Upload metadata"
lane :metadata do |options|
fastlane_require 'json'
if options[:enterprise]
metadata_path = "./fastlane/metadata-enterprise"
app_identifier = "com.irccloud.enterprise"
else
metadata_path = "./fastlane/metadata"
app_identifier = "com.irccloud.IRCCloud"
end
skip_screenshots = !options[:screenshots]
app_version = options[:app_version] || app_vers()
deliver(
app_version: app_version,
app_identifier: app_identifier,
skip_binary_upload: true,
skip_screenshots: skip_screenshots,
metadata_path: metadata_path,
automatic_release: true
)
end
desc "Make sure all devices are added to the ad-hoc profile"
lane :updateadhoc do
match(type: "adhoc", force_for_new_devices: true, app_identifier: "com.irccloud.IRCCloud")
match(type: "adhoc", force_for_new_devices: true, app_identifier: "com.irccloud.IRCCloud.ShareExtension")
match(type: "adhoc", force_for_new_devices: true, app_identifier: "com.irccloud.IRCCloud.NotificationService")
end
end
platform :mac do
desc "Build and push to iTunes Connect"
lane :push do |options|
pkg = "IRCCloud.pkg"
scheme = "IRCCloud"
# Set a build number manually if provided
# TODO pull this from the Info.plist
default_build_number = "GIT_VERSION"
if options[:build]
sh "cd .. && agvtool new-version -all #{options[:build]}"
end
# Build a pkg
gym(
scheme: scheme,
configuration: "AppStore",
export_method: "app-store",
catalyst_platform: "macos",
skip_profile_detection: true,
export_options: {
method: "app-store",
provisioningProfiles: {
"com.irccloud.IRCCloud" => "Catalyst IRCCloud",
"com.irccloud.IRCCloud.ShareExtension" => "Catalyst ShareExtension",
"com.irccloud.IRCCloud.NotificationService" => "Catalyst NotificationService",
}
}
)
# Reset the build number
if options[:build]
sh "cd .. && agvtool new-version -all #{default_build_number}"
end
# Upload to iTunes Connect
deliver(
pkg: pkg,
platform: "osx",
run_precheck_before_submit: false,
skip_metadata: true,
skip_screenshots: true
)
end
end
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
#