This repository has been archived by the owner on May 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Fastfile
213 lines (185 loc) · 5.6 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
# For basics, see
# https://github.com/osamaq/reactnative-fastlane-appcenter
# -------------Android Build & Deploy-------------#
platform :android do
# For android, you should setup signing for release builds.
# Currently, the default debug keystore is used.
desc 'Build the staging release APK.'
private_lane :build_staging do
gradle(task: 'clean', project_dir: 'android/')
sh("npm", "run", "make-apk:stagingRelease")
end
desc 'Build the production release APK.'
private_lane :build_production do
gradle(task: 'clean', project_dir: 'android/')
sh("npm", "run", "make-apk:productionRelease")
end
desc 'Upload the release APK to App Center.'
private_lane :upload do |options|
release_notes = options[:notes]
appcenter_upload(
api_token: ENV["APPCENTER_API_TOKEN"],
owner_name: ENV["APPCENTER_OWNER_NAME"],
app_name: ENV["APPCENTER_APP_NAME"],
apk: "./android/app/build/outputs/apk/release/app-release.apk",
notify_testers: ENV["NOTIFY_TESTERS"],
destinations: ENV["DESTINATIONS"],
release_notes: release_notes
)
end
desc 'Build, deploy staging Android.'
lane :deploy_staging do
build_staging
upload
end
desc 'Build, deploy production Android.'
lane :deploy_production do
build_production
upload
end
desc 'Bump, badge, deploy staging Android.'
lane :bump_badge_deploy_staging do
bump_badge
deploy_staging
end
desc 'Bump, badge, deploy production Android.'
lane :bump_badge_deploy_prod do
bump_badge
deploy_production
end
end
# -------------iOS Sign, Build & Deploy-------------#
platform :ios do
# You need to configure singing for iOS
# https://github.com/osamaq/reactnative-fastlane-appcenter#signing
desc 'Set up certs and profiles for iOS.'
lane :certificates do
register_devices(
devices: {
}
)
match(
app_identifier: 'com.app.bundle',
readonly: true,
force_for_new_devices: true,
)
end
desc 'Build the staging release iOS application.'
private_lane :build_staging do
gym(
scheme: "STAGING",
workspace: './ios/' + ENV['APP_NAME'] + '.xcworkspace',
export_method: 'ad-hoc'
)
end
desc 'Build the production release iOS application.'
private_lane :build_production do
gym(
scheme: "PRODUCTION",
workspace: './ios/' + ENV['APP_NAME'] + '.xcworkspace',
export_method: 'ad-hoc'
)
end
desc 'Upload the release IPA to App Center.'
private_lane :upload do |options|
release_notes = options[:notes]
appcenter_upload(
api_token: ENV["APPCENTER_API_TOKEN"],
owner_name: ENV["APPCENTER_OWNER_NAME"],
app_name: ENV["APPCENTER_APP_NAME"],
ipa: "./" + "Hello App Display Name" + ".ipa",
notify_testers: ENV["NOTIFY_TESTERS"],
destinations: ENV["DESTINATIONS"],
release_notes: release_notes
)
end
desc 'Sign, build, deploy staging iOS.'
lane :deploy_staging do
certificates
build_staging
upload
end
desc 'Sign, build, deploy production iOS.'
lane :deploy_production do
certificates
build_production
upload
end
desc 'Bump, badge, sign, build, deploy staging iOS.'
lane :bump_badge_deploy_staging do
bump_badge
deploy_staging
end
desc 'Bump, badge, sign, build, deploy production iOS.'
lane :bump_badge_deploy_prod do
bump_badge
deploy_production
end
end
# -------------Icons & Versioning-------------#
desc 'Android: Increment versionCode and set versionName to package.json version.'
package = load_json(json_path: "./package.json")
private_lane :inc_ver_and do
increment_version_code(
gradle_file_path: "./android/app/build.gradle",
)
increment_version_name(
gradle_file_path: "./android/app/build.gradle",
version_name: package['version']
)
end
desc 'iOS: Increment build number and set the version to package.json version.'
private_lane :inc_ver_ios do
increment_build_number(
xcodeproj: './ios/' + ENV['APP_NAME'] + '.xcodeproj'
)
increment_version_number(
xcodeproj: './ios/' + ENV['APP_NAME'] + '.xcodeproj',
version_number: package['version']
)
end
desc 'Bump build numbers, and set the display version to match the pacakage.json version.'
private_lane :bump do
inc_ver_ios
inc_ver_and
end
# To prepare the original icon set, see:
# https://developer.android.com/studio/write/image-asset-studio
desc 'Android: Overwrite the current icon set with a badged version.'
private_lane :make_badge_and do
package = load_json(json_path: "./package.json")
add_badge(
shield: "DEV-" + package['version'] + "-orange",
no_badge: true,
dark: true,
shield_scale: "0.55",
shield_gravity: "Center",
shield_geometry: "+0+30%",
glob: "/android/app/src/main/res/mipmap-*/ic_launcher*.png",
)
end
# To prepare the original icon set, you can use:
# https://appicon.co/
desc 'iOS: Overwrite the current icon set with a badged version.'
private_lane :make_badge_ios do
package = load_json(json_path: "./package.json")
add_badge(
shield: "DEV-" + package['version'] + "-orange",
no_badge: true,
dark: true,
shield_scale: "0.85",
shield_gravity: "South",
shield_geometry: "+0+5%",
glob: "/ios/" + ENV['APP_NAME'] + "/Images.xcassets/AppIcon.appiconset/*.png",
)
end
desc 'Make new versioned icon badges.'
lane :make_badge do
make_badge_ios
make_badge_and
end
desc 'Bump and badge iOS and Android.'
lane :bump_badge do
bump
make_badge
end