-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFastfile
206 lines (171 loc) · 6.58 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
# 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 "1.101.0"
default_platform :ios
platform :ios do
if ENV["FASTLANE_USER"]
fastlane_user = ENV["FASTLANE_USER"]
else
fastlane_user = "[email protected]"
end
puts "Fastfile fastlane_user is set to #{fastlane_user}"
if ENV["APP_DISPLAY_NAME"]
app_display_name = ENV["APP_DISPLAY_NAME"]
else
app_display_name = "QuantiModo"
end
puts "Fastfile app_display_name is set to #{app_display_name}"
team_id = "YD2FK7S2S5"
puts "Fastfile team_id is set to #{team_id}"
if ENV["APP_IDENTIFIER"]
app_identifier = ENV["APP_IDENTIFIER"]
else
app_identifier = "com.quantimodo.quantimodo"
end
puts "Fastfile app_identifier is set to #{app_identifier}"
if ENV["MATCH_KEYCHAIN_NAME"]
match_keychain_name = ENV["MATCH_KEYCHAIN_NAME"]
else
match_keychain_name = "ios-build.keychain"
end
puts "Fastfile match_keychain_name is set to #{match_keychain_name}"
xcodeproj = "./platforms/ios/#{app_display_name}.xcodeproj"
puts "Fastfile xcodeproj is set to #{xcodeproj}"
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
end
desc "Runs all the tests"
lane :test do
scan
end
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :beta do
if ENV["TRAVIS"]
puts "Running beta lane..."
else
puts "Use `bundle exec fastlane deploy` locally because fastlane beta messes up your keychain and doesn't work anyway..."
abort
end
ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "120"
#sh "cd .. && ruby hooks/xcodeprojectfix.rb"
def ensure_temp_keychain(name)
begin
delete_keychain(
name: name
) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db")
rescue
puts 'Error deleting keychain!'
end
begin
create_keychain(
name: name,
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: false,
add_to_search_list: true
)
rescue
puts 'Error creating keychain!'
end
end
if ENV["TRAVIS"]
ensure_temp_keychain match_keychain_name
# create_keychain(
# name: match_keychain_name,
# password: ENV["MATCH_KEYCHAIN_PASSWORD"],
# default_keychain: true,
# unlock: true,
# timeout: 3600,
# add_to_search_list: true
# )
else
puts "Not messing up local keychain. Maybe use deploy lane locally"
# ensure_temp_keychain match_keychain_name
end
puts "Unlock keychain to prevent generating multiple keychains which increases build time (https://github.com/fastlane/fastlane/issues/7505#issuecomment-267445102)"
unlock_keychain(
path: match_keychain_name,
add_to_search_list: :replace,
password: ENV['MATCH_KEYCHAIN_PASSWORD']
)
match(git_url: "https://github.com/mikepsinn/ios-certificates.git", # more information: https://codesigning.guide
app_identifier: app_identifier,
type: "appstore",
readonly: true, #readonly mode to be sure it won't create any new certificates or profiles.
keychain_name: match_keychain_name,
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"]
)
if ENV["TRAVIS"]
puts "Can't use pem on Travis..."
else
puts "Automatically generate and renewing push notification profiles with pem..."
pem(app_identifier: app_identifier)
end
puts "recreate_schemes for some reason..."
recreate_schemes(project: xcodeproj)
puts "Building app with gym..."
gym(scheme: app_display_name,
project: xcodeproj) # Build your app - more options available # Build your app - more options available
puts "Uploading build to iTunes Connect with pilot..."
pilot(
username: fastlane_user,
skip_submission: true,
distribute_external: false,
skip_waiting_for_build_processing: true
)
# sh "your_script.sh"
# You can also use other beta testing services here (run `fastlane actions`)
end
desc "Deploy ios app on the appstore"
lane :deploy do
puts "upgrade_super_old_xcode_project to fix Seems to be a very old project file format - please open your project file in a more recent version of Xcode"
upgrade_super_old_xcode_project(
path: xcodeproj,
team_id: team_id
)
puts "Disabling automatic_code_signing to fix QuantiModo has conflicting provisioning settings"
automatic_code_signing( path: xcodeproj, use_automatic_signing: false )
match(git_url: "https://github.com/mikepsinn/ios-certificates.git", # more information: https://codesigning.guide
app_identifier: app_identifier,
type: "appstore",
readonly: true, #readonly mode to be sure it won't create any new certificates or profiles.
#keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
#keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"]
team_id: team_id
)
update_project_provisioning(
xcodeproj: xcodeproj,
profile: ENV["sigh_#{app_identifier}_appstore_profile-path"],
build_configuration: "Release"
)
cordova(platform: 'ios', team_id: team_id)
appstore(ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'], skip_screenshots: true)
end
# You can define as many lanes as you want
after_all do |lane|
# This block is called, only if the executed lane was successful
# slack(
# message: "Successfully deployed new App Update."
# )
end
error do |lane, exception|
# slack(
# message: exception.message,
# success: false
# )
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