Class: Fastlane::Actions::SubmitToBetaAppReviewAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



114
115
116
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 114

def self.authors
  ["dwlz"]
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 36

def self.available_options
  default_user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
  default_user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)

  default_app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
  default_itc_team_id = CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id)
  default_itc_team_name = CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name)
  [
    FastlaneCore::ConfigItem.new(
      key: :bundle_identifier,
      env_name: "BETAREVIEW_BUNDLE_IDENTIFIER",
      description: "The bundle identifier of your app",
      optional: true,
      conflicting_options: [:apple_id],
      default_value: default_app_identifier
    ),

    FastlaneCore::ConfigItem.new(
      key: :apple_id,
      env_name: "BETAREVIEW_APPLE_ID",
      description: "Apple ID of the application",
      optional: true,
      conflicting_options: [:bundle_identifier],
      is_string: true,
    ),

    FastlaneCore::ConfigItem.new(
      key: :username,
      env_name: "BETAREVIEW_USER",
      description: "Your Apple ID Username",
      default_value: default_user
    ),

    FastlaneCore::ConfigItem.new(
      key: :itc_team_id,
      env_name: "BETAREVIEW_TEAM_ID",
      description: "The ID of your iTunes Connect team if you're in multiple teams",
      optional: true,
      default_value: default_itc_team_id,
      verify_block: proc do |value|
        ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s
      end
    ),

    FastlaneCore::ConfigItem.new(
      key: :itc_team_name,
      env_name: "BETAREVIEW_TEAM_NAME",
      description: "The name of your iTunes Connect team if you're in multiple teams",
      optional: true,
      default_value: default_itc_team_name,
      verify_block: proc do |value|
        ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
      end
    ),

    FastlaneCore::ConfigItem.new(
      key: :build_number,
      env_name: "BETAREVIEW_BUILD_NUMBER",
      description: "Build number",
      optional: false,
      is_string: true
    ),

    FastlaneCore::ConfigItem.new(
      key: :beta_app_review_information,
      description: "Metadata: A hash containing the beta app review information",
      optional: true,
      is_string: false
    ),
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 28

def self.description
  "Submits an already processed build to Beta App Review."
end

.detailsObject



32
33
34
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 32

def self.details
  "This action submits an already processed build to Beta App Review."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 118

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



108
109
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 108

def self.output
end

.return_valueObject



111
112
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 111

def self.return_value
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fastlane/plugin/submit_to_beta_app_review/actions/submit_to_beta_app_review_action.rb', line 4

def self.run(params)
  UI.message("Login to iTunes Connect (#{params[:username]})")
  Spaceship::Tunes::(params[:username])
  Spaceship::Tunes.select_team
  UI.message("Login successful")

  app = Spaceship::Tunes::Application.find(params[:apple_id] || params[:bundle_identifier])

  version = app.edit_version
  build = version.candidate_builds.find { |b| b.build_version == params[:build_number] }
  UI.message("Submitting to Beta App Review...")

  begin
    build.submit_for_beta_review!(params[:beta_app_review_information])
    UI.success("Submitted! 🎉")
  rescue
    UI.error("An iTunes Connect error was encountered and the build was not submitted.")
  end
end