pilot/lib/pilot/build_manager.rb in fastlane-2.61.0.beta.20171006010004 vs pilot/lib/pilot/build_manager.rb in fastlane-2.61.0.beta.20171007010004

- old
+ new

@@ -132,26 +132,29 @@ UI.message("Distributing new build to testers: #{uploaded_build.train_version} - #{uploaded_build.build_version}") # This is where we could add a check to see if encryption is required and has been updated uploaded_build.export_compliance.encryption_updated = false - if options[:distribute_external] + if options[:groups] || options[:distribute_external] uploaded_build.beta_review_info.demo_account_required = false uploaded_build.submit_for_testflight_review! + end + + if options[:groups] + groups = Spaceship::TestFlight::Group.filter_groups(app_id: uploaded_build.app_id) do |group| + options[:groups].include?(group.name) + end + groups.each do |group| + uploaded_build.add_group!(group) + end + end + + if options[:distribute_external] external_group = Spaceship::TestFlight::Group.default_external_group(app_id: uploaded_build.app_id) uploaded_build.add_group!(external_group) unless external_group.nil? if external_group.nil? && options[:groups].nil? UI.user_error!("You must specify at least one group using the `:groups` option to distribute externally") - end - - if options[:groups] - groups = Spaceship::TestFlight::Group.filter_groups(app_id: uploaded_build.app_id) do |group| - options[:groups].include?(group.name) - end - groups.each do |group| - uploaded_build.add_group!(group) - end end else # distribute internally # in case any changes to export_compliance are required if uploaded_build.export_compliance_missing? uploaded_build.save!