forked from ohmyzsh/ohmyzsh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitrise.yml
433 lines (413 loc) · 14.1 KB
/
bitrise.yml
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
---
format_version: '4'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
workflow: ad-hoc-ios
- tag: "*"
workflow: app-store-ios
workflows:
app-store-ios:
before_run:
- _setup
steps:
- ios-auto-provision:
inputs:
- generate_profiles: 'yes'
- distribution_type: app-store
- team_id: "$MASSIVE_TEAM"
- certificate-and-profile-installer: {}
- xcode-archive:
inputs:
- compile_bitcode: 'no'
- team_id: "$MASSIVE_TEAM"
- export_method: app-store
- deploy-to-bitrise-io:
inputs:
- notify_user_groups: none
- deploy-to-itunesconnect-deliver:
inputs:
- password: "$ITUNES_PASSWORD"
- team_name: "$ITUNES_CONNECT_TEAM_NAME"
- bundle_id: "$APP_STORE_BUNDLE_ID"
- itunescon_user: "$ITUNES_EMAIL"
inputs:
- channel: axis-native-releases
- timestamp: 'no'
- footer_icon: ''
- footer: ''
- message: ''
- pretext: "*Axis iOS $XPI_VERSION released to Test Flight!*"
- author_name: ''
- title: ''
- pretext_on_error: "*Axis iOS $XPI_VERSION release failed*"
- message_on_error: ''
- fields: ''
- buttons: |
View App|${BITRISE_APP_URL}
View Build|${BITRISE_BUILD_URL}
- webhook_url: https://hooks.slack.com/services/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
description: Deploys to the App store and Test Flight
after_run:
- _complete
envs:
- BITRISE_SCHEME: Axis_iOS Demo
_setup:
steps:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
inputs:
- content: |-
#!/usr/bin/env bash
curl https://$STASH_DOMAIN/rest/build-status/1.0/commits/$GIT_CLONE_COMMIT_HASH \
-u $STASH_USER:$STASH_PASSWORD \
-H 'Content-Type: application/json' \
--data-binary \
$'{
"state": "INPROGRESS",
"key": "'$BITRISE_APP_TITLE'",
"name": "Bitrise '$BITRISE_APP_TITLE' #'$BITRISE_BUILD_NUMBER'",
"url": "'$BITRISE_BUILD_URL'",
"description": "'$BITRISE_TRIGGERED_WORKFLOW_ID' workflow"
}' \
--compressed
title: Report build status
inputs:
- workdir: |-
$BITRISE_SOURCE_DIR
$MINT_DIRECTORY
inputs:
- content: |-
#!/usr/bin/env bash
# debug log
set -x
# install all tools
sh scripts/install-tools.sh
title: Install tools
- carthage:
inputs:
- carthage_options: "--platform iOS --cache-builds --new-resolver"
title: Generate Project
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
sh scripts/generate-project.sh
- set-xcode-build-number:
inputs:
- plist_path: "$INFO_PLIST_PATH"
inputs:
- info_plist_path: "$INFO_PLIST_PATH"
is_always_run: true
inputs:
- cache_paths: |
$BITRISE_CACHE_DIR
$MINT_DIRECTORY
_complete:
steps:
is_always_run: true
inputs:
- cache_paths: |
$BITRISE_CACHE_DIR
$MINT_DIRECTORY
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
if [ $BITRISE_BUILD_STATUS == "0" ]; then
BUILD_STATE="SUCCESSFUL"
else
BUILD_STATE="FAILED"
fi
curl https://$STASH_DOMAIN/rest/build-status/1.0/commits/$GIT_CLONE_COMMIT_HASH \
-u $STASH_USER:$STASH_PASSWORD \
-H 'Content-Type: application/json' \
--data-binary \
$'{
"state": "'$BUILD_STATE'",
"key": "'$BITRISE_APP_TITLE'",
"name": "Bitrise '$BITRISE_APP_TITLE' #'$BITRISE_BUILD_NUMBER'",
"url": "'$BITRISE_BUILD_URL'",
"description": "'$BITRISE_TRIGGERED_WORKFLOW_ID' workflow"
}' \
--compressed
title: Report Build Status
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
brew install jq
echo Matching pull request for commit $GIT_CLONE_COMMIT_HASH
STASH_PULL_REQUEST_ID=$(curl -s -X GET https://stash.massiveinteractive.com/rest/api/1.0/projects/MUI/repos/axis-sdk-apple/pull-requests \
-u $STASH_USER:$STASH_PASSWORD \
| jq --arg COMMIT "$GIT_CLONE_COMMIT_HASH" '.values[] | select(.fromRef.latestCommit == $COMMIT) | .id')
if [ -z "$STASH_PULL_REQUEST_ID" ]; then
echo No pull request found for this commit
exit 0
fi
echo Pull request \#$STASH_PULL_REQUEST_ID was found
echo Retriving linked JIRA issues
JIRA_ISSUES=$(curl -s -X GET https://stash.massiveinteractive.com/rest/jira/1.0/projects/MUI/repos/axis-sdk-apple/pull-requests/$STASH_PULL_REQUEST_ID/issues \
-u $STASH_USER:$STASH_PASSWORD | jq '.[]')
if [ -z "$JIRA_ISSUES" ]; then
echo No linked JIRA issue
exit 0
fi
ISSUE_KEYS=$(echo $JIRA_ISSUES | jq -r '.key')
COMMENT_PREFIX="(Auto Updated) Bitrise $BITRISE_APP_TITLE build"
if [ $BITRISE_BUILD_STATUS == "0" ]; then
BUILD_STATE="successful (/)"
else
BUILD_STATE="failed (x)"
fi
update_comment()
{
if [ "$1" == "add" ]; then
TARGET_URL=https://agile.massiveinteractive.com/rest/api/2/issue/$2/comment
METHOD=POST
elif [ "$1" == "delete" ]; then
TARGET_URL=https://agile.massiveinteractive.com/rest/api/2/issue/$2/comment/$3
METHOD=DELETE
else
exit
fi
curl -s -X $METHOD $TARGET_URL \
-u $STASH_USER:$STASH_PASSWORD \
-o /dev/null \
-H 'Content-Type: application/json' \
-d @message.json
}
for KEY in $ISSUE_KEYS
do
echo
echo Updating comment for issue $KEY
COMMENT_ID=$(curl -s -X GET https://agile.massiveinteractive.com/rest/api/2/issue/$KEY/comment \
-u $STASH_USER:$STASH_PASSWORD \
| jq -r --arg STASH_USER "$STASH_USER" --arg COMMENT "$COMMENT_PREFIX" \
'.comments[] | select(.author.key == $STASH_USER) | select(.body | contains($COMMENT)) | .id')
echo \{\"body\": \"$COMMENT_PREFIX \[\#$BITRISE_BUILD_NUMBER\|$BITRISE_BUILD_URL\] $BUILD_STATE\"\} > message.json
if [ -z "$COMMENT_ID" ]; then
echo Comment not found. Adding a new comment
update_comment add $KEY
else
echo Comment exists. Deleting existing comment and adding a new one to keep it at bottom
update_comment delete $KEY $COMMENT_ID
update_comment add $KEY
fi
done
rm message.json
title: Update comment on JIRA issue
description: Runs steps that happen after everything else
app-store-tvos:
before_run:
- _setup
steps:
inputs:
- plist_path: Axis_tvOS_topshelf/Info.plist
inputs:
- team_id: "$MASSIVE_TEAM"
- generate_profiles: 'yes'
- distribution_type: app-store
- [email protected]: {}
inputs:
- compile_bitcode: 'no'
- team_id: "$MASSIVE_TEAM"
- export_method: app-store
inputs:
- notify_user_groups: none
inputs:
- password: "$ITUNES_PASSWORD"
- team_name: "$ITUNES_CONNECT_TEAM_NAME"
- bundle_id: "$APP_STORE_BUNDLE_ID"
- platform: appletvos
- itunescon_user: "$ITUNES_EMAIL"
inputs:
- channel: axis-native-releases
- timestamp: 'no'
- footer_icon: ''
- footer: ''
- message: ''
- pretext: "*Axis tvOS $XPI_VERSION released to Test Flight!*"
- author_name: ''
- title: ''
- pretext_on_error: "*Axis tvOS $XPI_VERSION release failed*"
- message_on_error: ''
- fields: |
App|tvOS
Branch|${BITRISE_GIT_BRANCH}
Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
- webhook_url: https://hooks.slack.com/services/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
description: Deploys to the App store and Test Flight
after_run:
- _complete
envs:
- BITRISE_SCHEME: Axis_tvOS Demo
- INFO_PLIST_PATH: Axis_tvOS/Assets/Info.plist
ad-hoc-ios:
before_run:
- _setup
steps:
- ios-auto-provision:
inputs:
- distribution_type: ad-hoc
- generate_profiles: 'yes'
- team_id: "$MASSIVE_TEAM"
- certificate-and-profile-installer: {}
- xcode-archive:
inputs:
- upload_bitcode: 'no'
- compile_bitcode: 'no'
- team_id: "$MASSIVE_TEAM"
- export_method: ad-hoc
- deploy-to-bitrise-io:
inputs:
- notify_user_groups: none
inputs:
- channel: axis-ios-builds
- timestamp: 'no'
- footer_icon: ''
- footer: ''
- message: ''
- pretext: "*Axis iOS $XPI_VERSION build succeeded!*"
- author_name: ''
- title: ''
- pretext_on_error: "*Axis iOS $XPI_VERSION build failed*"
- message_on_error: ''
- fields: |
App|${BITRISE_APP_TITLE}
Branch|${BITRISE_GIT_BRANCH}
Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
Build|${BITRISE_BUILD_NUMBER}
- buttons: |-
View App|${BITRISE_APP_URL}
View Build|${BITRISE_BUILD_URL}
Install Page|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
- webhook_url: https://hooks.slack.com/services/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
description: Builds and deploys to Bitrise
after_run:
- _complete
ad-hoc-tvos:
before_run:
- _setup
steps:
inputs:
- distribution_type: ad-hoc
- configuration: ''
- generate_profiles: 'yes'
- team_id: "$MASSIVE_TEAM"
- [email protected]: {}
inputs:
- compile_bitcode: 'no'
- team_id: "$MASSIVE_TEAM"
- export_method: ad-hoc
inputs:
- notify_user_groups: none
inputs:
- channel: axis-ios-builds
- timestamp: 'no'
- footer_icon: ''
- footer: ''
- message: ''
- pretext: "*Axis tvOS $XPI_VERSION build succeeded!*"
- author_name: ''
- title: ''
- pretext_on_error: "*Axis tvOS $XPI_VERSION build failed*"
- message_on_error: ''
- webhook_url: https://hooks.slack.com/services/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
- fields: |
App|tvOS
Branch|${BITRISE_GIT_BRANCH}
Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
description: Deploys to the App store and Test Flight
after_run:
- _complete
envs:
- BITRISE_SCHEME: Axis_tvOS Demo
- INFO_PLIST_PATH: Axis_tvOS/Assets/Info.plist
unit-test:
before_run:
- _setup
steps:
- ios-auto-provision:
inputs:
- generate_profiles: 'yes'
- distribution_type: ad-hoc
- team_id: "$MASSIVE_TEAM"
- certificate-and-profile-installer: {}
- xcode-archive:
inputs:
- upload_bitcode: 'no'
- compile_bitcode: 'no'
- team_id: "$MASSIVE_TEAM"
- xcodebuild_options: "-allowProvisioningUpdates"
- export_method: ad-hoc
inputs:
- xcodebuild_options: "-UseModernBuildSystem=NO"
- [email protected]: {}
- deploy-to-bitrise-io:
inputs:
- notify_user_groups: none
inputs:
- channel: axis-ios-builds
- timestamp: 'no'
- footer_icon: ''
- footer: ''
- message: ''
- pretext: "*Axis iOS $XPI_VERSION build succeeded!*"
- author_name: ''
- title: ''
- pretext_on_error: "*Axis iOS $XPI_VERSION build failed*"
- message_on_error: ''
- fields: |
App|${BITRISE_APP_TITLE}
Branch|${BITRISE_GIT_BRANCH}
Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
Build|${BITRISE_BUILD_NUMBER}
- buttons: |-
View App|${BITRISE_APP_URL}
View Build|${BITRISE_BUILD_URL}
Install Page|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
- webhook_url: https://hooks.slack.com/services/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
description: Builds and deploys to Bitrise
after_run:
- _complete
envs:
- ADDON_VDTESTING_API_TOKEN: ''
app:
envs:
- BITRISE_PROJECT_PATH: Axis.xcodeproj
- BITRISE_SCHEME: Axis_iOS QA2
- BITRISE_EXPORT_METHOD: app-store
- MINT_DIRECTORY: "/usr/local/lib/mint"
- MASSIVE_TEAM: 3PU2FX2MA5
- ENTERPRISE_TEAM: 3ABLN8ETNM
- ITUNES_CONNECT_TEAM_NAME: Massive Interactive Pty Ltd
- INFO_PLIST_PATH: Axis_iOS/Assets/Info.plist
- APP_STORE_BUNDLE_ID: co.massive.axis.demo
- STASH_DOMAIN: stash.massiveinteractive.com