-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathFastfile
151 lines (128 loc) · 4.74 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
default_platform(:ios)
platform :ios do
########################--------------------------------########################
########################--------- SETUP LANES ----------########################
########################--------------------------------########################
# Environment Setup
## Setup local environment configuraiton. If running on a CI machine we need to create a keychain to store the
## distribution certificates
private_lane :setup_environment do
if is_ci
create_keychain(
name: ENV["KEYCHAIN_NAME"],
password: ENV["KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: false
)
end
end
# Provisions and Certificates Setup
## Download and setup all necessary provisions and certificates (Dev & Dist)
desc "Setup Development & Distribution profiles and certificates in the local machine"
lane :setup_provisions do
setup_environment
# Install Distribution Provisions and Certificates
match(
app_identifier: "com.olmps.memoClient",
type: "appstore",
readonly: true,
keychain_name: ENV["KEYCHAIN_NAME"],
keychain_password: ENV["KEYCHAIN_PASSWORD"],
verbose: true,
)
# Install Development Provisions and Certificates
match(
app_identifier: "com.olmps.memoClient",
type: "development",
readonly: true,
keychain_name: ENV["KEYCHAIN_NAME"],
keychain_password: ENV["KEYCHAIN_PASSWORD"],
verbose: true,
)
end
########################--------------------------------########################
########################-------- RELEASE LANE ----------########################
########################--------------------------------########################
# Release a new version to Testflight
#
# It assumes that the app version is correctly set.
# The lane increments the build number if necessary
desc "Release app to Testflight"
lane :release do
api_key = app_store_connect_api_key(
key_id: ENV["APP_STORE_API_KEY_ID"],
issuer_id: ENV["APP_STORE_API_ISSUER_ID"],
key_content: ENV["APP_STORE_API_KEY"],
in_house: false,
)
# Setup provision profiles
setup_provisions
# Clean
sh("flutter", "clean")
# Pub get
sh("flutter", "pub", "get")
# Increment the build number (use the latest build number for this version + 1)
increment_build_number(
build_number: latest_testflight_build_number(
initial_build_number: 0,
api_key: api_key,
version: get_version_number
) + 1,
xcodeproj: "Runner.xcodeproj",
)
# Run flutter build with release mode
sh("flutter", "build", "ipa", "--release", "--dart-define=ENV=PROD", "--export-options-plist=ios/exportOptions.plist")
# Zip dSYMs
sh(
"zip",
"/Users/runner/work/memo/memo/build/ios/archive/Runner.xcarchive/dSYMs.zip",
"/Users/runner/work/memo/memo/build/ios/archive/Runner.xcarchive/dSYMs"
)
# Upload dSYM files to Firebae Crashlytics
upload_symbols_to_crashlytics(
app_id: ENV["FIREBASE_APP_ID"],
dsym_path: "/Users/runner/work/memo/memo/build/ios/archive/Runner.xcarchive/dSYMs.zip",
binary_path: "/Users/runner/work/memo/memo/ios/Pods/FirebaseCrashlytics/upload-symbols",
)
# Upload to Testflight
changelog = File.read("Changelog.txt")
upload_to_testflight(
api_key: api_key,
distribute_external: true,
groups: [
'External Testers'
],
changelog: changelog,
ipa: '../build/ios/ipa/Memo.ipa'
)
end
# Release a new version to Firebase Distribution
#
# It assumes that the app version is correctly set.
desc "Release app to Firebase Distribution"
lane :firebase do
# Clean
sh("flutter", "clean")
# Pub get
sh("flutter", "pub", "get")
# Run flutter build with release mode
sh("flutter", "build", "ipa", "--dart-define=ENV=DEV", "--export-options-plist=ios/exportOptions-dev.plist")
sh("zip", "../../build/ios/archive/Runner.xcarchive/dSYMs.zip", "../../build/ios/archive/Runner.xcarchive/dSYMs")
# Upload dSYM files to Firebae Crashlytics
upload_symbols_to_crashlytics(
app_id: ENV["MEMO_IOS_FIREBASE_APP_ID"],
dsym_path: "../build/ios/archive/Runner.xcarchive/dSYMs.zip",
gsp_path: "./Runner/GoogleService-Info.plist",
binary_path: "Pods/FirebaseCrashlytics/upload-symbols",
)
firebase_app_distribution(
ipa_path: '../build/ios/ipa/Memo.ipa',
app: ENV["MEMO_IOS_FIREBASE_APP_ID"],
googleservice_info_plist_path: "./Runner/GoogleService-Info.plist",
groups: "internal-testers",
service_credentials_file: "../firebase_distribution_service_account.json"
)
end
end