-
Notifications
You must be signed in to change notification settings - Fork 0
/
ios
219 lines (168 loc) · 4.61 KB
/
ios
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
def ios_archive (options)
return xcode_archive(options)
end
def xcode_archive (options)
buildOptions = {}
if (ENV.key?('APP_SCHEME'))
buildOptions[:scheme] = ENV['APP_SCHEME']
end
if (ENV.key?('APP_XCWORKSPACE'))
buildOptions[:workspace] = ENV['APP_XCWORKSPACE']
elsif (ENV.key?('APP_XCODEPROJ'))
buildOptions[:project] = ENV['APP_XCODEPROJ']
end
buildOptions[:export_method] = 'development'
buildOptions[:configuration] = 'Debug'
buildOptions[:output_directory] = output_path
if (options[:env] === 'staging' || options[:env] === 'prod')
buildOptions[:export_method] = 'app-store'
buildOptions[:configuration] = 'Release'
end
build_app(buildOptions)
end
platform :ios do
lane :generate_google_services do
if (ENV.key?('GOOGLE_SERVICES_PLIST'))
gpg_decrypt( file: ENV['GOOGLE_SERVICES_PLIST'], passphrase: ENV['GPG_PASSPHRASE'] )
end
end
lane :version do |options|
project = options[:project] ? options[:project] : ENV['APP_XCODEPROJ']
version = options[:version] ? options[:version] : ENV['APP_VERSION']
if (project.empty?)
return
end
if (version)
increment_version_number(
xcodeproj: project,
version_number: version
)
elsif (options[:version_bump])
increment_version_number(
xcodeproj: project,
bump_type: options[:version_bump]
)
end
unless options[:build_number].nil?
increment_build_number(
xcodeproj: project,
build_number: options[:build_number]
)
end
end
lane :certificate do |options|
if (ENV.key?('MATCH_TYPE'))
type = ENV['MATCH_TYPE']
end
if (options[:type])
type = options[:type]
end
readonly = ENV['MATCH_READONLY']
password = ENV['FASTLANE_PASSWORD']
if (readonly.nil? && (password.nil? || password.empty?))
readonly = true
end
username = ENV['MATCH_USERNAME'] ? ENV['MATCH_USERNAME'] : ENV['FASTLANE_USER']
if (!username.empty?)
match(
username: username,
app_identifier: ENV['APP_IDENTIFIER'],
readonly: readonly,
type: type
)
end
end
lane :certificates do
certificate( type: "development" )
certificate( type: "appstore" )
end
lane :prepare do |options|
requirements(options)
generate_google_services
skip_certificates = options[:skip_certificates] ? options[:skip_certificates] : ENV['MATCH_SKIP_CERTIFICATES']
if (!skip_certificates)
certificates(options)
end
# after prepare
after_ios_prepare(options)
end
lane :build do |options|
# prepare generate google services check install
prepare(options)
begin
ios_archive_override(options)
rescue
ios_archive(options)
end
bitrise_env('BITRISE_DEPLOY_DIR', output_path())
# after build
after_ios_build(options)
end
lane :dev do |options|
ENV['LANE_ENV'] = 'dev'
options[:env] = 'dev'
before_ios_dev(options)
version(options)
build(options)
after_ios_dev(options)
end
lane :staging do |options|
ENV['LANE_ENV'] = 'staging'
options[:env] = 'staging'
before_ios_staging(options)
version(options)
unless options[:skip_build]
build(options)
end
username = ENV['DELIVER_USER'] ? ENV['DELIVER_USER'] : ENV['FASTLANE_USER']
defaultOptions = {
username: username,
app_identifier: ENV['APP_IDENTIFIER'],
skip_submission: true
}
upload_to_testflight(defaultOptions)
after_ios_staging(options)
end
lane :prod do |options|
ENV['LANE_ENV'] = 'prod'
options[:env] = 'prod'
before_ios_prod(options)
version(options)
unless options[:skip_build]
build(options)
end
username = ENV['DELIVER_USER'] ? ENV['DELIVER_USER'] : ENV['FASTLANE_USER']
defaultOptions = {
username: username,
app_identifier: ENV['APP_IDENTIFIER'],
skip_metadata: true,
skip_screenshots: true
}
upload_to_app_store(defaultOptions)
after_ios_prod(options)
end
end
lane :after_ios_prepare do |options|
UI.success "hook after_ios_prepare"
end
lane :after_ios_build do |options|
UI.success "hook after_ios_builds"
end
lane :after_ios_dev do |options|
UI.success "hook after_ios_dev"
end
lane :after_ios_staging do |options|
UI.success "hook after_ios_staging"
end
lane :after_ios_prod do |options|
UI.success "hook after_ios_prod"
end
lane :before_ios_dev do |options|
UI.success "hook before_ios_dev"
end
lane :before_ios_staging do |options|
UI.success "hook before_ios_staging"
end
lane :before_ios_prod do |options|
UI.success "hook before_ios_prod"
end