Skip to content

Commit 1b5632a

Browse files
committed
ci: update Fastfile to manage builds for both iOS, macOS and visionOS
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 483028d commit 1b5632a

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

DesignToolbox/fastlane/Fastfile

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ platform :ios do
419419

420420
# Stable app must point to OUDS iOS version
421421
if check_package_version_for_stable_app
422-
build
422+
build(os_type: "iOS")
423+
build(os_type: "macOS")
424+
build(os_type: "visionOS")
423425

424426
if params[:upload]
425427
puts "Upload to store requested"
@@ -446,7 +448,9 @@ platform :ios do
446448
if isAlpha # Alpha case, detailSymbol should be the issue number of the feature/fix to test
447449
puts "👉 Build and upload (alpha)"
448450
update_build_number
449-
build
451+
build(os_type: "iOS")
452+
build(os_type: "macOS")
453+
build(os_type: "visionOS")
450454
upload_2_testflight(type: BuildType::ALPHA, issues_numbers: params[:issues])
451455
publish_github_notifications_build_details(BuildType::ALPHA, get_info_plist_value(path: "#{Dir.pwd}/../#{OUDS_PROJECT_NAME}/Info.plist", key: "OUDSBuildDetails"))
452456

@@ -460,7 +464,9 @@ platform :ios do
460464
if tag_ci_build(detailSymbol)
461465
# Ensure this build-then-uploaded app has a new and unique build number matching also to code version
462466
update_build_number
463-
build
467+
build(os_type: "iOS")
468+
build(os_type: "macOS")
469+
build(os_type: "visionOS")
464470
else
465471
puts "ℹ️ Nothing new to build today, a CI tag for commit '#{detailSymbol}' already exists"
466472
publish_mattermost_notification("⚙️ 🤔 Nothing new to build today, a CI tag for commit '#{detailSymbol}' already exists")
@@ -487,8 +493,9 @@ platform :ios do
487493
# PRIVATE LANE BUILD (ALPHA / BETA / STABLE is set by main lane)
488494
# -----------------------------------------------------------------------
489495
desc "Build the demo app"
490-
private_lane :build do
491-
puts "👉 Build"
496+
private_lane :build do |params|
497+
os_type = params[:os_type]
498+
puts "👉 Build for '#{os_type}'"
492499

493500
begin
494501
update_app_identifier(
@@ -501,29 +508,45 @@ platform :ios do
501508
clean_install: true
502509
)
503510

511+
# Must match provisioning profile installed in the computer and defined in Xcode settigns for the target
512+
profile_name = case os_type
513+
when "iOS"
514+
'OUDS iOS app (release)'
515+
when "macOS"
516+
'OUDS macOS app (release)'
517+
when "visionOS"
518+
'OUDS visionOS app (development)'
519+
else
520+
raise "❌ Error: not managed OS : #{os_type}"
521+
end
522+
523+
# Must match provisioning profile installed in the computer and defined in Xcode settigns for the target
524+
artifactName = "oudsApp-#{os_type}"
525+
504526
# Disable automatic code signing for release / distribution builds.
505527
# Thus we won't use any Xcode with plugged account in, and use only needed certificates and provisioning profiles.
506-
# Mobile provisioning profile named "OUDS demo app (release)" must be placed in runner.
507-
# The certificate(s) used to build (with bundle ID) the provisionning profile must be available in the keychain of the runner
528+
# Mobile provisioning profiles named above must be placed in runner.
529+
# The certificate(s) used to build (with bundle ID) the provisionning profile(s) must be available in the keychain of the runner
508530
# (both .cer and .p12), here a distribution certificate.
509531
# This way is more agile and allows to use VM-based solution with on the fly configuration like with Tart.
510532
update_code_signing_settings(path: "#{OUDS_PROJECT}",
511533
use_automatic_signing: false,
512-
profile_name: 'OUDS demo app (release)',
513-
targets: OUDS_SCHEME)
534+
profile_name: profile_name,
535+
targets: OUDS_SCHEME,
536+
build_configurations: ["Release"])
514537

515538
gym(workspace: "#{OUDS_WORKSPACE}",
516539
scheme: OUDS_SCHEME,
517540
configuration: "Release",
518541
output_directory: "build/",
519542
export_method: "app-store",
520-
archive_path: "build/oudsApp.xcarchive",
543+
archive_path: "build/#{artifactName}.xcarchive",
521544
xcargs: "-allowProvisioningUpdates")
522545

523546
# Build a ZIP archive to put as artifact to the GitLab CI runner
524547
# Needed for upload later as .xcarchive for App Store through corporate portal
525-
zip(path: "build/oudsApp.xcarchive",
526-
output_path: "build/oudsApp.zip")
548+
zip(path: "build/#{artifactName}.xcarchive",
549+
output_path: "build/#{artifactName}.zip")
527550

528551
version = get_app_version
529552
build_number = get_build_number(xcodeproj: OUDS_PROJECT)

0 commit comments

Comments
 (0)