-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathbuild-ios-upload-to-browserstack.yml
More file actions
502 lines (437 loc) · 22.3 KB
/
build-ios-upload-to-browserstack.yml
File metadata and controls
502 lines (437 loc) · 22.3 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
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# This workflow creates two non E2E iOS Builds and uploads to BrowserStack
# Build 1: With ADDITIONAL_SRP_1 and PREDEFINED_PASSWORD (pre-imported wallet) using build_ios_main_prod
# Build 2: Without these environment variables (fresh wallet) using build_ios_qa_prod
name: Build iOS Dual Versions and Upload to BrowserStack
on:
workflow_call:
inputs:
browserstack_app_url_ios_onboarding:
required: false
type: string
description: 'BrowserStack iOS Onboarding App URL (bs://...)'
browserstack_app_url_ios_imported_wallet:
required: false
type: string
description: 'BrowserStack iOS Imported Wallet App URL (bs://...)'
branch_name:
required: false
type: string
description: 'Branch name to use for builds (defaults to github.ref_name)'
build_variant:
required: false
type: string
description: 'Build variant for Bitrise (rc = release, exp = experimental)'
default: 'rc'
runner_provider:
description: Runner provider forwarded from the caller
required: false
type: string
default: current
outputs:
with-srp-ipa-uploaded:
description: 'Whether the with-SRP IPA was successfully uploaded'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.with-srp-ipa-uploaded }}
without-srp-ipa-uploaded:
description: 'Whether the without-SRP IPA was successfully uploaded'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.without-srp-ipa-uploaded }}
with-srp-browserstack-url:
description: 'BrowserStack URL for with-SRP version'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.with-srp-browserstack-url }}
without-srp-browserstack-url:
description: 'BrowserStack URL for without-SRP version'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.without-srp-browserstack-url }}
with-srp-version:
description: 'App version for with-SRP build'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.with-srp-version }}
without-srp-version:
description: 'App version for without-SRP build'
value: ${{ jobs.download-and-upload-to-browserstack.outputs.without-srp-version }}
workflow_dispatch:
inputs:
description:
description: 'Optional description for this build run'
required: false
type: string
runner_provider:
description: Runner provider for this manual trial run
required: false
type: choice
options:
- current
- namespace
default: current
permissions:
contents: read
id-token: write
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BITRISE_APP_ID: ${{ secrets.BITRISE_APP_ID }}
BITRISE_BUILD_TRIGGER_TOKEN: ${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}
BITRISE_API_TOKEN: ${{ secrets.BITRISE_API_TOKEN }}
jobs:
check-builds-needed:
name: Check if iOS builds are needed
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
outputs:
builds-needed: ${{ steps.check-builds.outputs.builds-needed }}
steps:
- name: Check if builds are needed
id: check-builds
run: |
# Check if any BS URLs are provided via workflow inputs
if [ -n "${{ inputs.browserstack_app_url_ios_onboarding }}" ] || [ -n "${{ inputs.browserstack_app_url_ios_imported_wallet }}" ]; then
echo "builds-needed=false" >> "$GITHUB_OUTPUT"
echo "Skipping iOS builds - BS URLs provided via workflow inputs"
else
echo "builds-needed=true" >> "$GITHUB_OUTPUT"
echo "iOS builds needed - no BS URLs provided"
fi
trigger-ios-with-srp-build:
name: Trigger iOS with-SRP Build on Bitrise
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
needs: [check-builds-needed]
env:
METAMASK_WORKFLOW: ${{ inputs.build_variant == 'exp' && 'build_ios_main_exp' || 'build_ios_main_rc' }}
outputs:
build-id: ${{ steps.trigger-build.outputs.build-id }}
build-slug: ${{ steps.trigger-build.outputs.build-slug }}
steps:
- name: Trigger iOS with-SRP Build on Bitrise
id: trigger-build
if: needs.check-builds-needed.outputs.builds-needed == 'true'
run: |
echo "Triggering iOS with-SRP build on Bitrise..."
echo "Workflow: $METAMASK_WORKFLOW"
echo "BITRISE_APP_ID: $BITRISE_APP_ID"
echo "Current branch: ${{ inputs.branch_name || github.ref_name }}"
# Validate required environment variables
if [[ -z "$BITRISE_APP_ID" ]]; then
echo "Error: BITRISE_APP_ID is not set"
exit 1
fi
if [[ -z "$BITRISE_BUILD_TRIGGER_TOKEN" ]]; then
echo "Error: BITRISE_BUILD_TRIGGER_TOKEN is not set"
exit 1
fi
if [[ -z "$BITRISE_API_TOKEN" ]]; then
echo "Error: BITRISE_API_TOKEN is not set"
exit 1
fi
# Set environment variables for with-SRP build
ENV_VARS='[
{
"mapped_to": "ADDITIONAL_SRP_1",
"value": "'"${{ secrets.IN_BUILD_SRP }}"'",
"is_expand": true
},
{
"mapped_to": "PREDEFINED_PASSWORD",
"value": "'"${{ secrets.E2E_PASSWORD }}"'",
"is_expand": true
},
{
"mapped_to": "DISABLE_NOTIFICATION_PROMPT",
"value": "true",
"is_expand": true
}
]'
CUSTOM_ID="MetaMask-iOS-With-SRP-${{ github.run_id }}"
# Trigger iOS workflow
BUILD_RESPONSE=$(curl -s -X POST \
"https://app.bitrise.io/app/$BITRISE_APP_ID/build/start.json" \
-H "Content-Type: application/json" \
-d '{
"build_params": {
"branch": "${{ inputs.branch_name || github.ref_name }}",
"workflow_id": "${{ env.METAMASK_WORKFLOW }}",
"commit_message": "Triggered by iOS Dual Versions workflow - Build with Predefined-SRP",
"environments": '"$ENV_VARS"',
"custom_id": "'"$CUSTOM_ID"'"
},
"hook_info": {
"type": "bitrise",
"build_trigger_token": "'"$BITRISE_BUILD_TRIGGER_TOKEN"'"
},
"triggered_by": "GitHub Actions iOS Dual Versions - Build with Predefined-SRP"
}')
echo "Build response: $BUILD_RESPONSE"
BUILD_SLUG=$(echo "$BUILD_RESPONSE" | jq -r '.build_slug')
echo "Build slug: $BUILD_SLUG"
if [[ -z "$BUILD_SLUG" || "$BUILD_SLUG" == "null" ]]; then
echo "Error: Failed to get build slug"
echo "Full response: $BUILD_RESPONSE"
exit 1
fi
# Wait for the workflow to complete
echo "Waiting for $METAMASK_WORKFLOW to complete..."
TIMEOUT=1800 # 30 minutes
ELAPSED=0
while [ $ELAPSED -lt $TIMEOUT ]; do
BUILD_RESPONSE=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$BUILD_SLUG")
BUILD_STATUS=$(echo "$BUILD_RESPONSE" | jq -r '.data.status')
echo "Build status: $BUILD_STATUS (elapsed: ${ELAPSED}s)"
# Check for successful completion (status 1 or success/succeeded)
if [ "$BUILD_STATUS" = "1" ] || [ "$BUILD_STATUS" = "success" ] || [ "$BUILD_STATUS" = "succeeded" ]; then
echo "Build completed successfully"
break
elif [ "$BUILD_STATUS" = "0" ] || [ "$BUILD_STATUS" = "in_progress" ] || [ "$BUILD_STATUS" = "running" ]; then
echo "Build is in progress..."
elif [ "$BUILD_STATUS" = "2" ] || [ "$BUILD_STATUS" = "failed" ] || [ "$BUILD_STATUS" = "aborted" ]; then
echo "Build failed with status: $BUILD_STATUS"
exit 1
else
echo "Unknown build status: $BUILD_STATUS"
fi
sleep 30
ELAPSED=$((ELAPSED + 30))
done
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
echo "Timeout waiting for build to complete"
echo "Final build status: $BUILD_STATUS"
echo "Build slug: $BUILD_SLUG"
exit 1
fi
# Get the build ID from the completed build
BUILD_ID=$(echo "$BUILD_RESPONSE" | jq -r '.data.slug')
if [[ -z "$BUILD_ID" || "$BUILD_ID" == "null" ]]; then
echo "Error: Failed to get build ID"
exit 1
fi
echo "Build ID: $BUILD_ID"
echo "Build Slug: $BUILD_SLUG"
# Set outputs
{
echo "build-id=$BUILD_ID"
echo "build-slug=$BUILD_SLUG"
} >> "$GITHUB_OUTPUT"
trigger-ios-without-srp-build:
name: Trigger iOS without-SRP Build on Bitrise
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
needs: [check-builds-needed]
env:
METAMASK_WORKFLOW: ${{ inputs.build_variant == 'exp' && 'build_ios_main_exp' || 'build_ios_main_rc' }}
outputs:
build-id: ${{ steps.trigger-build.outputs.build-id }}
build-slug: ${{ steps.trigger-build.outputs.build-slug }}
steps:
- name: Trigger iOS without-SRP Build on Bitrise
id: trigger-build
if: needs.check-builds-needed.outputs.builds-needed == 'true'
run: |
echo "Triggering iOS without-SRP build on Bitrise..."
echo "Workflow: $METAMASK_WORKFLOW"
echo "BITRISE_APP_ID: $BITRISE_APP_ID"
echo "Current branch: ${{ inputs.branch_name || github.ref_name }}"
# Validate required environment variables
if [[ -z "$BITRISE_APP_ID" ]]; then
echo "Error: BITRISE_APP_ID is not set"
exit 1
fi
if [[ -z "$BITRISE_BUILD_TRIGGER_TOKEN" ]]; then
echo "Error: BITRISE_BUILD_TRIGGER_TOKEN is not set"
exit 1
fi
if [[ -z "$BITRISE_API_TOKEN" ]]; then
echo "Error: BITRISE_API_TOKEN is not set"
exit 1
fi
# Without-SRP build: seedless / BrowserStack perf onboarding (E2E_MOCK_OAUTH).
# Optional E2E_MOCK_OAUTH_EMAIL overrides request email_id (default newuser+e2e@web3auth.io).
ENV_VARS=$(jq -n \
--arg byoa "${{ secrets.E2E_BYOA_AUTH_SECRET }}" \
--arg email "${{ secrets.E2E_MOCK_OAUTH_EMAIL }}" \
'[{"mapped_to":"DISABLE_NOTIFICATION_PROMPT","value":"true","is_expand":true},{"mapped_to":"E2E_MOCK_OAUTH","value":"true","is_expand":true},{"mapped_to":"E2E_BYOA_AUTH_SECRET","value":$byoa,"is_expand":true},{"mapped_to":"E2E_MOCK_OAUTH_EMAIL","value":$email,"is_expand":true}]')
CUSTOM_ID="MetaMask-iOS-Without-SRP-${{ github.run_id }}"
# Trigger iOS workflow
BUILD_RESPONSE=$(curl -s -X POST \
"https://app.bitrise.io/app/$BITRISE_APP_ID/build/start.json" \
-H "Content-Type: application/json" \
-d '{
"build_params": {
"branch": "${{ inputs.branch_name || github.ref_name }}",
"workflow_id": "${{ env.METAMASK_WORKFLOW }}",
"commit_message": "Triggered by iOS Dual Versions workflow - Build without Predefined-SRP",
"environments": '"$ENV_VARS"',
"custom_id": "'"$CUSTOM_ID"'"
},
"hook_info": {
"type": "bitrise",
"build_trigger_token": "'"$BITRISE_BUILD_TRIGGER_TOKEN"'"
},
"triggered_by": "GitHub Actions iOS Dual Versions - Build without Predefined-SRP"
}')
echo "Build response: $BUILD_RESPONSE"
BUILD_SLUG=$(echo "$BUILD_RESPONSE" | jq -r '.build_slug')
echo "Build slug: $BUILD_SLUG"
if [[ -z "$BUILD_SLUG" || "$BUILD_SLUG" == "null" ]]; then
echo "Error: Failed to get build slug"
echo "Full response: $BUILD_RESPONSE"
exit 1
fi
# Wait for the workflow to complete
echo "Waiting for $METAMASK_WORKFLOW to complete..."
TIMEOUT=1800 # 30 minutes
ELAPSED=0
while [ $ELAPSED -lt $TIMEOUT ]; do
BUILD_RESPONSE=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$BUILD_SLUG")
BUILD_STATUS=$(echo "$BUILD_RESPONSE" | jq -r '.data.status')
echo "Build status: $BUILD_STATUS (elapsed: ${ELAPSED}s)"
# Check for successful completion (status 1 or success/succeeded)
if [ "$BUILD_STATUS" = "1" ] || [ "$BUILD_STATUS" = "success" ] || [ "$BUILD_STATUS" = "succeeded" ]; then
echo "Build completed successfully"
break
elif [ "$BUILD_STATUS" = "0" ] || [ "$BUILD_STATUS" = "in_progress" ] || [ "$BUILD_STATUS" = "running" ]; then
echo "Build is in progress..."
elif [ "$BUILD_STATUS" = "2" ] || [ "$BUILD_STATUS" = "failed" ] || [ "$BUILD_STATUS" = "aborted" ]; then
echo "Build failed with status: $BUILD_STATUS"
exit 1
else
echo "Unknown build status: $BUILD_STATUS"
fi
sleep 30
ELAPSED=$((ELAPSED + 30))
done
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
echo "Timeout waiting for build to complete"
echo "Final build status: $BUILD_STATUS"
echo "Build slug: $BUILD_SLUG"
exit 1
fi
# Get the build ID from the completed build
BUILD_ID=$(echo "$BUILD_RESPONSE" | jq -r '.data.slug')
if [[ -z "$BUILD_ID" || "$BUILD_ID" == "null" ]]; then
echo "Error: Failed to get build ID"
exit 1
fi
echo "Build ID: $BUILD_ID"
echo "Build Slug: $BUILD_SLUG"
# Set outputs
{
echo "build-id=$BUILD_ID"
echo "build-slug=$BUILD_SLUG"
} >> "$GITHUB_OUTPUT"
download-and-upload-to-browserstack:
name: Download IPAs and Upload to BrowserStack
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
needs: [check-builds-needed, trigger-ios-with-srp-build, trigger-ios-without-srp-build]
if: (needs.trigger-ios-with-srp-build.result == 'success' || needs.trigger-ios-with-srp-build.result == 'partial_success') && (needs.trigger-ios-without-srp-build.result == 'success' || needs.trigger-ios-without-srp-build.result == 'partial_success')
outputs:
with-srp-ipa-uploaded: ${{ steps.browserstack-upload.outputs.with-srp-ipa-uploaded }}
without-srp-ipa-uploaded: ${{ steps.browserstack-upload.outputs.without-srp-ipa-uploaded }}
with-srp-browserstack-url: ${{ steps.browserstack-upload.outputs.with-srp-browserstack-url }}
without-srp-browserstack-url: ${{ steps.browserstack-upload.outputs.without-srp-browserstack-url }}
with-srp-app-id: ${{ steps.browserstack-upload.outputs.with-srp-app-id }}
without-srp-app-id: ${{ steps.browserstack-upload.outputs.without-srp-app-id }}
with-srp-version: ${{ steps.browserstack-upload.outputs.with-srp-version }}
without-srp-version: ${{ steps.browserstack-upload.outputs.without-srp-version }}
steps:
- name: Checkout code
if: needs.check-builds-needed.outputs.builds-needed == 'true'
uses: actions/checkout@v4
- name: Download and Upload IPAs to BrowserStack
if: needs.check-builds-needed.outputs.builds-needed == 'true'
id: browserstack-upload
run: |
echo "Downloading IPAs from Bitrise and uploading to BrowserStack..."
# Initialize upload status outputs
{
echo "with-srp-ipa-uploaded=false"
echo "without-srp-ipa-uploaded=false"
} >> "$GITHUB_OUTPUT"
# Get build IDs from job outputs
WITH_SRP_BUILD_ID="${{ needs.trigger-ios-with-srp-build.outputs.build-id }}"
WITHOUT_SRP_BUILD_ID="${{ needs.trigger-ios-without-srp-build.outputs.build-id }}"
echo "With-SRP build ID: $WITH_SRP_BUILD_ID"
echo "Without-SRP build ID: $WITHOUT_SRP_BUILD_ID"
# Download with-SRP IPA
if [ -n "$WITH_SRP_BUILD_ID" ]; then
echo "Downloading with-SRP IPA..."
WITH_SRP_ARTIFACTS=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$WITH_SRP_BUILD_ID/artifacts")
# Find the IPA artifact with main-* pattern
WITH_SRP_IPA_ARTIFACT=$(echo "$WITH_SRP_ARTIFACTS" | jq -r '.data[] |
select(.title | endswith(".ipa")) |
select(.title | test("metamask-device-main-[a-zA-Z0-9-]+-[0-9]+\\.ipa"))')
if [[ -n "$WITH_SRP_IPA_ARTIFACT" ]]; then
WITH_SRP_IPA_SLUG=$(echo "$WITH_SRP_IPA_ARTIFACT" | jq -r '.slug')
WITH_SRP_DOWNLOAD_URL=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$WITH_SRP_BUILD_ID/artifacts/$WITH_SRP_IPA_SLUG" | \
jq -r '.data.expiring_download_url')
if [[ -n "$WITH_SRP_DOWNLOAD_URL" && "$WITH_SRP_DOWNLOAD_URL" != "null" ]]; then
echo "Downloading with-SRP IPA..."
wget -O "metamask-ios-with-srp.ipa" "$WITH_SRP_DOWNLOAD_URL"
# Upload to BrowserStack
echo "Uploading with-SRP IPA to BrowserStack..."
WITH_SRP_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@metamask-ios-with-srp.ipa" \
-F "custom_id=MetaMask-iOS-With-SRP-${{ github.run_id }}")
WITH_SRP_APP_URL=$(echo "$WITH_SRP_RESPONSE" | jq -r '.app_url')
WITH_SRP_APP_ID=$(echo "$WITH_SRP_RESPONSE" | jq -r '.app_id')
echo "With-SRP IPA uploaded successfully"
echo " App URL: $WITH_SRP_APP_URL"
echo " App ID: $WITH_SRP_APP_ID"
{
echo "with-srp-browserstack-url=$WITH_SRP_APP_URL"
echo "with-srp-app-id=$WITH_SRP_APP_ID"
echo "with-srp-version=Bitrise-Build"
echo "with-srp-ipa-uploaded=true"
} >> "$GITHUB_OUTPUT"
else
echo "Failed to get with-SRP IPA download URL"
fi
else
echo "With-SRP IPA artifact not found (looking for metamask-device-main-*-*.ipa)"
fi
else
echo "With-SRP build ID not available"
fi
# Download without-SRP IPA
if [ -n "$WITHOUT_SRP_BUILD_ID" ]; then
echo "Downloading without-SRP IPA..."
WITHOUT_SRP_ARTIFACTS=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$WITHOUT_SRP_BUILD_ID/artifacts")
# Find the IPA artifact with main-* pattern
WITHOUT_SRP_IPA_ARTIFACT=$(echo "$WITHOUT_SRP_ARTIFACTS" | jq -r '.data[] |
select(.title | endswith(".ipa")) |
select(.title | test("metamask-device-main-[a-zA-Z0-9-]+-[0-9]+\\.ipa"))')
if [[ -n "$WITHOUT_SRP_IPA_ARTIFACT" ]]; then
WITHOUT_SRP_IPA_SLUG=$(echo "$WITHOUT_SRP_IPA_ARTIFACT" | jq -r '.slug')
WITHOUT_SRP_DOWNLOAD_URL=$(curl -s -H "Authorization: $BITRISE_API_TOKEN" \
"https://api.bitrise.io/v0.1/apps/$BITRISE_APP_ID/builds/$WITHOUT_SRP_BUILD_ID/artifacts/$WITHOUT_SRP_IPA_SLUG" | \
jq -r '.data.expiring_download_url')
if [[ -n "$WITHOUT_SRP_DOWNLOAD_URL" && "$WITHOUT_SRP_DOWNLOAD_URL" != "null" ]]; then
echo "Downloading without-SRP IPA..."
wget -O "metamask-ios-without-srp.ipa" "$WITHOUT_SRP_DOWNLOAD_URL"
# Upload to BrowserStack
echo "Uploading without-SRP IPA to BrowserStack..."
WITHOUT_SRP_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@metamask-ios-without-srp.ipa" \
-F "custom_id=MetaMask-iOS-Without-SRP-${{ github.run_id }}")
WITHOUT_SRP_APP_URL=$(echo "$WITHOUT_SRP_RESPONSE" | jq -r '.app_url')
WITHOUT_SRP_APP_ID=$(echo "$WITHOUT_SRP_RESPONSE" | jq -r '.app_id')
echo "Without-SRP IPA uploaded successfully"
echo "App URL: $WITHOUT_SRP_APP_URL"
echo "App ID: $WITHOUT_SRP_APP_ID"
{
echo "without-srp-browserstack-url=$WITHOUT_SRP_APP_URL"
echo "without-srp-app-id=$WITHOUT_SRP_APP_ID"
echo "without-srp-version=Bitrise-Build"
echo "without-srp-ipa-uploaded=true"
} >> "$GITHUB_OUTPUT"
else
echo "Failed to get without-SRP IPA download URL"
fi
else
echo "Without-SRP IPA artifact not found (looking for metamask-device-main-*-*.ipa)"
fi
else
echo "Without-SRP build ID not available"
fi
echo "BrowserStack upload process completed!"
echo "With-SRP URL: $WITH_SRP_APP_URL"
echo "Without-SRP URL: $WITHOUT_SRP_APP_URL"