Skip to content

Instantly share code, notes, and snippets.

@cohen72
Last active June 30, 2024 09:43
Show Gist options
  • Save cohen72/66c759eb37cc350edf92c665b51ac5df to your computer and use it in GitHub Desktop.
Save cohen72/66c759eb37cc350edf92c665b51ac5df to your computer and use it in GitHub Desktop.
private_lane :configure_ios do
google_services_plist_src = "whitelabels/#{ENV["UNIQUE_WHITELABEL_ID"]}/GoogleService-Info.plist"
ios_dest = "../ios/#{ENV["XCODE_PROJECT_NAME"]}"
sh("cp #{google_services_plist_src} #{ios_dest}")
configure_assets("ios")
xcodeproj_path = "./ios/#{ENV["XCODE_PROJECT_NAME"]}.xcodeproj"
increment_build_number_in_plist(
xcodeproj: xcodeproj_path,
scheme: ENV["XCODE_SCHEME"],
build_number: "#{@build_number}",
)
update_info_plist(
xcodeproj: xcodeproj_path,
plist_path: "./#{ENV["XCODE_PROJECT_NAME"]}/Info.plist",
display_name: (ENV["WHITE_LABEL_NAME"]).to_s,
)
update_plist(
plist_path: "./ios/#{ENV["XCODE_PROJECT_NAME"]}/Info.plist",
block: proc do |plist|
plist["FacebookDisplayName"] = (ENV["FACEBOOK_DISPLAY_NAME"]).to_s
plist["FacebookAppID"] = (ENV["FACEBOOK_APP_ID"]).to_s
plist["CodePushDeploymentKey"] = (ENV["CodePushDeploymentKey_iOS"]).to_s
plist["BugsnagAPIKey"] = (ENV["BUGSNAG_NOTIFIER_API_KEY"]).to_s
end,
)
### update deep link url scheme
update_info_plist(
xcodeproj: xcodeproj_path,
plist_path: "./#{ENV["XCODE_PROJECT_NAME"]}/Info.plist",
block: proc do |plist|
urlScheme = plist["CFBundleURLTypes"].find { |scheme| scheme["CFBundleURLName"] == "bundle_identifier" }
urlScheme[:CFBundleURLSchemes] = [ENV["DEEPLINK_SCHEME"]]
end,
)
update_ios_entitlements_file
update_app_identifier(
xcodeproj: xcodeproj_path,
plist_path: "./#{ENV["XCODE_PROJECT_NAME"]}/Info.plist",
app_identifier: (ENV["BUNDLE_IDENTIFIER"]).to_s,
)
produce(
username: ENV["APPSTORE_USER"],
app_identifier: ENV["BUNDLE_IDENTIFIER"],
app_name: ENV["WHITE_LABEL_NAME"],
language: "English",
app_version: "1.0",
sku: ENV["SKU"],
enable_services: {
associated_domains: "on",
push_notification: "on",
},
)
match(
type: "appstore",
username: ENV["APPSTORE_USER"],
app_identifier: [ENV["BUNDLE_IDENTIFIER"]],
)
if !is_on_ci
match(
type: "development",
username: ENV["APPSTORE_USER"],
app_identifier: [ENV["BUNDLE_IDENTIFIER"]],
)
end
sigh(
username: ENV["APPSTORE_USER"],
app_identifier: ENV["BUNDLE_IDENTIFIER"],
output_path: "ios/provisioning_profiles",
)
update_project_provisioning(
xcodeproj: xcodeproj_path,
profile: ENV["SIGH_PROFILE_PATH"],
target_filter: ENV["XCODE_TARGET_NAME"],
build_configuration: "Release",
)
cocoapods(podfile: "./ios/Podfile") unless !is_on_ci
end
def update_ios_entitlements_file
entitlements_file_path = "./ios/#{ENV["XCODE_WORKSPACE_NAME"]}/<organization>.entitlements"
deeplink_scheme = "applinks:#{ENV["DEEPLINK_SCHEME"]}.page.link"
update_plist( # Updates the CLIENT_ID and GOOGLE_APP_ID string entries in the plist-file
plist_path: entitlements_file_path,
block: proc do |plist|
plist[:"com.apple.developer.associated-domains"] = [deeplink_scheme]
end
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment