require 'fastlane_core/configuration/config_item' require 'credentials_manager/appfile_config' require_relative 'module' module Pilot class Options def self.available_options user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :api_key_path, env_names: ["PILOT_API_KEY_PATH", "APP_STORE_CONNECT_API_KEY_PATH"], description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)", optional: true, conflicting_options: [:username], verify_block: proc do |value| UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :api_key, env_names: ["PILOT_API_KEY", "APP_STORE_CONNECT_API_KEY"], description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)", type: Hash, optional: true, sensitive: true, conflicting_options: [:api_key_path, :username]), # app upload info FastlaneCore::ConfigItem.new(key: :username, short_option: "-u", env_name: "PILOT_USERNAME", description: "Your Apple ID Username", optional: true, default_value: user, default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :app_identifier, short_option: "-a", env_name: "PILOT_APP_IDENTIFIER", description: "The bundle identifier of the app to upload or manage testers (optional)", optional: true, code_gen_sensitive: true, # This incorrect env name is here for backwards compatibility default_value: ENV["TESTFLIGHT_APP_IDENTITIFER"] || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier), default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :app_platform, short_option: "-m", env_name: "PILOT_PLATFORM", description: "The platform to use (optional)", optional: true, default_value: 'ios', verify_block: proc do |value| UI.user_error!("The platform can only be ios, appletvos, or osx") unless ['ios', 'appletvos', 'osx'].include?(value) end), FastlaneCore::ConfigItem.new(key: :apple_id, short_option: "-p", env_name: "PILOT_APPLE_ID", description: "Apple ID property in the App Information section in App Store Connect", optional: true, code_gen_sensitive: true, default_value: ENV["TESTFLIGHT_APPLE_ID"], default_value_dynamic: true, type: String, verify_block: proc do |value| error_message = "`apple_id` value is incorrect. The correct value should be taken from Apple ID property in the App Information section in App Store Connect." # Validate if the value is not an email address UI.user_error!(error_message) if value =~ /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i # Validate if the value is not a bundle identifier UI.user_error!(error_message) if value =~ /^[A-Za-x]{2,6}((?!-)\.[A-Za-z0-9-]{1,63}(? 0 end), FastlaneCore::ConfigItem.new(key: :wait_processing_timeout_duration, env_name: "PILOT_WAIT_PROCESSING_TIMEOUT_DURATION", description: "Timeout duration in seconds to wait for App Store Connect processing. If set, after exceeding timeout duration, this will `force stop` to wait for App Store Connect processing and exit with exception", optional: true, type: Integer, verify_block: proc do |value| UI.user_error!("Please enter a valid positive number of seconds") unless value.to_i > 0 end), FastlaneCore::ConfigItem.new(key: :wait_for_uploaded_build, env_name: "PILOT_WAIT_FOR_UPLOADED_BUILD", deprecated: "No longer needed with the transition over to the App Store Connect API", description: "Use version info from uploaded ipa file to determine what build to use for distribution. If set to false, latest processing or any latest build will be used", is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :reject_build_waiting_for_review, short_option: "-b", env_name: "PILOT_REJECT_PREVIOUS_BUILD", description: "Expire previous if it's 'waiting for review'", is_string: false, default_value: false) ] end end end