-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathFastfile
254 lines (204 loc) · 6.63 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
current_changelog_file = File.dirname(Dir.pwd)+"/current_changelog.txt"
changelog_file = File.dirname(Dir.pwd)+"/changelog.txt"
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta_ci do
xcodes(
select_for_current_build_only: true
)
setup_ci if is_ci
app_store_connect_api_key(
key_id: ENV["APP_STORE_CONNECT_API_KEY_ID"],
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
key_filepath: ENV["APP_STORE_CONNECT_KEY_FILEPATH"],
key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"],
in_house: false,
)
previous_build_number = latest_testflight_build_number()
next_build_number = previous_build_number + 1
current_build_number = Integer(get_build_number(
xcodeproj: "swift-paperless.xcodeproj",
))
puts "Current build number: #{current_build_number}"
puts "Next build number: #{next_build_number}"
if current_build_number != next_build_number
UI.user_error!("Build number is not at #{next_build_number}, but at #{current_build_number}")
end
match(type: "development", readonly: is_ci)
match(
type: "appstore",
app_identifier: [
"com.paulgessinger.swift-paperless",
"com.paulgessinger.swift-paperless.ShareExtension"
],
readonly: is_ci
)
ensure_git_status_clean
changelog = File.read(changelog_file)
changelog = %{
PLEASE DO NOT SEND ME SCREENSHOTS WITH CONFIDENTIAL DOCUMENTS!
Redact screenshots to not include information that you do not wish to expose.
---
} + changelog
# Change code signing settings after committing
update_code_signing_settings(
use_automatic_signing: false,
path: "swift-paperless.xcodeproj",
team_id: "ZHKJ4NHK6F",
code_sign_identity: "iPhone Developer",
sdk: "iphoneos*",
targets: ["swift-paperless"],
profile_name: "match Development com.paulgessinger.swift-paperless",
)
update_code_signing_settings(
use_automatic_signing: false,
path: "swift-paperless.xcodeproj",
team_id: "ZHKJ4NHK6F",
code_sign_identity: "iPhone Developer",
sdk: "iphoneos*",
targets: ["ShareExtension"],
profile_name: "match Development com.paulgessinger.swift-paperless.ShareExtension",
)
version = get_version_number(
xcodeproj: "swift-paperless.xcodeproj",
target: "swift-paperless"
)
build_ios_app(
scheme: "swift-paperless",
xcargs: "-skipPackagePluginValidation -skipMacroValidation" # seemingly no alternative on CI
)
upload_to_testflight(
changelog: changelog,
skip_waiting_for_build_processing: ENV["CI"]
)
end
lane :beta do
app_store_connect_api_key(
key_id: ENV["APP_STORE_CONNECT_API_KEY_ID"],
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
key_filepath: ENV["APP_STORE_CONNECT_KEY_FILEPATH"],
key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"],
in_house: false,
)
ensure_git_branch(branch: "^main|develop\/.+$")
ensure_git_status_clean
git_pull(rebase: true)
previous_build_number = latest_testflight_build_number()
next_build_number = previous_build_number + 1
current_build_number = Integer(get_build_number(
xcodeproj: "swift-paperless.xcodeproj",
))
puts "Current build number: #{current_build_number}"
puts "Next build number: #{next_build_number}"
if current_build_number == next_build_number
puts "Build number is already at #{current_build_number}, nothing to do"
next
end
version = get_version_number(
xcodeproj: "swift-paperless.xcodeproj",
target: "swift-paperless"
)
increment_build_number(
xcodeproj: "swift-paperless.xcodeproj",
build_number: next_build_number
)
current_changelog = File.read(current_changelog_file)
if not current_changelog.empty?
changelog = File.read(changelog_file)
combined_changelog = "#{version} (#{next_build_number})\n\n" + current_changelog
if changelog != ""
combined_changelog += "\n" + changelog
end
File.write(changelog_file, combined_changelog)
File.write(current_changelog_file, "")
end
git_commit(
path: ["swift-paperless.xcodeproj", changelog_file, current_changelog_file],
message: "Bump build number to #{next_build_number}"
)
push_to_git_remote()
github_release = set_github_release(
repository_name: "paulgessinger/swift-paperless",
api_bearer: ENV["GITHUB_TOKEN"],
name: "v#{version} (#{next_build_number})",
tag_name: "builds/#{version}/#{next_build_number}",
description: current_changelog,
commitish: "main",
is_prerelease: true
)
end
lane :bump_build do
previous_build_number = latest_testflight_build_number()
current_build_number = previous_build_number + 1
increment_build_number(
xcodeproj: "swift-paperless.xcodeproj",
build_number: current_build_number
)
end
lane :certs do
app_store_connect_api_key(
key_id: ENV["APP_STORE_CONNECT_API_KEY_ID"],
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
key_filepath: ENV["APP_STORE_CONNECT_KEY_FILEPATH"],
key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"],
in_house: false,
)
match(type: "appstore")
match(type: "development")
end
lane :tests do
xcodes(
select_for_current_build_only: true
)
run_tests(
scheme: "swift-paperlessTests",
xcargs: "-skipPackagePluginValidation -skipMacroValidation",
output_types: ""
)
spm(
command: "test",
package_path: "Common",
)
spm(
command: "test",
package_path: "DataModel",
)
spm(
command: "test",
package_path: "Networking",
)
end
lane :build do |options|
xcodes(
select_for_current_build_only: true
)
device = options.fetch(:device, "iPhone 16 Pro")
ios = options.fetch(:ios, "18.2")
build_app(
scheme: "swift-paperless",
destination: "platform=iOS Simulator,OS=#{ios},name=#{device}",
xcargs: "-skipPackagePluginValidation -skipMacroValidation",
configuration: "Release",
)
end
lane :screenshots do
xcodes(
select_for_current_build_only: true
)
snapshot()
end
end