-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastfile
More file actions
133 lines (106 loc) · 3.13 KB
/
Copy pathFastfile
File metadata and controls
133 lines (106 loc) · 3.13 KB
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
XCODE_PROJ = "DevLog.xcodeproj"
APP_IDENTIFIER = "opfic.DevLog"
TARGET_NAME = "DevLog"
default_platform(:ios)
platform :ios do
private_lane :fetch_latest_testflight_build_number do |options|
require "spaceship"
versionNumber = options[:version]
app = Spaceship::ConnectAPI::App.find(APP_IDENTIFIER)
UI.user_error!("Could not find app for #{APP_IDENTIFIER}") if app.nil?
filter = {
"state" => "PROCESSING,FAILED,COMPLETE",
"cfBundleShortVersionString" => versionNumber,
"platform" => Spaceship::ConnectAPI::Platform.map("ios")
}
build = Spaceship::ConnectAPI.get_build_uploads(
app_id: app.id,
filter: filter,
sort: "-uploadedDate",
limit: 1
).first
next 0 if build.nil?
next build.cf_build_version.to_i
end
private_lane :asc_api_key do
app_store_connect_api_key(
key_id: ENV["ASC_KEY_ID"],
issuer_id: ENV["ASC_ISSUER_ID"],
key_filepath: ENV["ASC_KEY_PATH"],
in_house: false
)
end
private_lane :build_for_store do
if ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"].to_s.strip.empty?
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "30"
end
if ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"].to_s.strip.empty?
ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"] = "5"
end
api_key = asc_api_key
versionNumber = get_version_number(
xcodeproj: XCODE_PROJ,
target: TARGET_NAME
)
latestTestflightBuildNumber = fetch_latest_testflight_build_number(
version: versionNumber
)
setup_ci if ENV["CI"]
increment_build_number(
xcodeproj: XCODE_PROJ,
build_number: latestTestflightBuildNumber + 1
)
match(
api_key: api_key,
type: "development",
readonly: ENV["CI"] == "true"
)
match(
api_key: api_key,
type: "appstore",
readonly: ENV["CI"] == "true"
)
if ENV["CI"] == "true"
provisioningProfileSpecifier = lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING][APP_IDENTIFIER].to_s
UI.user_error!("Missing App Store provisioning profile mapping for #{APP_IDENTIFIER}") if provisioningProfileSpecifier.empty?
update_code_signing_settings(
use_automatic_signing: false,
path: XCODE_PROJ,
sdk: "iphoneos*",
team_id: ENV["APP_STORE_TEAM_ID"],
targets: [TARGET_NAME],
build_configurations: ["Release"],
code_sign_identity: "Apple Distribution",
profile_name: provisioningProfileSpecifier
)
end
build_app(
project: XCODE_PROJ,
scheme: TARGET_NAME,
export_method: "app-store",
xcargs: "-skipPackagePluginValidation"
)
next api_key
end
lane :deploy_testflight do
api_key = build_for_store
upload_to_testflight(
api_key: api_key,
skip_waiting_for_build_processing: true
)
end
lane :testflight_build_only do
build_for_store
end
lane :release do
api_key = build_for_store
upload_to_app_store(
api_key: api_key,
force: true,
skip_metadata: true,
skip_screenshots: true,
submit_for_review: true,
automatic_release: false
)
end
end