Class: Fastlane::Actions::UpdateAppAgeRatingAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::UpdateAppAgeRatingAction
- Defined in:
- fastlane/lib/fastlane/actions/update_app_age_rating.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Documentation collapse
- .authors ⇒ Object
- .category ⇒ Object
- .example_code ⇒ Object
-
.is_supported?(platform) ⇒ Boolean
rubocop:disable Naming/PredicateName.
- .return_value ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
172 173 174 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 172 def self. ["PratikPatil131"] end |
.available_options ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 15 def self. [ FastlaneCore::ConfigItem.new( key: :api_key_path, env_names: ["DELIVER_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/)", optional: true, conflicting_options: %i[api_key], 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: ["DELIVER_API_KEY", "APP_STORE_CONNECT_API_KEY"], description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/)", optional: true, conflicting_options: %i[api_key_path], sensitive: true, type: Hash ), FastlaneCore::ConfigItem.new( key: :app_identifier, env_name: "DELIVER_APP_IDENTIFIER", description: "The bundle identifier of your app", optional: false, type: String, code_gen_sensitive: true ), FastlaneCore::ConfigItem.new( key: :username, env_name: "DELIVER_USER", description: "Your Apple ID username", optional: true, type: String ), FastlaneCore::ConfigItem.new( key: :age_rating_config_path, env_name: "DELIVER_AGE_RATING_CONFIG_PATH", description: "Path to the JSON file containing the age rating configuration", optional: false, type: String, verify_block: proc do |value| UI.user_error!("Age rating configuration file not found at: '#{value}'") unless File.exist?(value) end ), FastlaneCore::ConfigItem.new( key: :team_id, env_name: "FASTLANE_TEAM_ID", description: "The ID of your App Store Connect team if you're in multiple teams", optional: true, type: String, code_gen_sensitive: true ), FastlaneCore::ConfigItem.new( key: :team_name, env_name: "FASTLANE_TEAM_NAME", description: "The name of your App Store Connect team if you're in multiple teams", optional: true, type: String ) ] end |
.category ⇒ Object
168 169 170 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 168 def self.category :app_store_connect end |
.description ⇒ Object
4 5 6 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 4 def self.description "Update your app's age rating on App Store Connect" end |
.details ⇒ Object
8 9 10 11 12 13 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 8 def self.details "Updates only the age rating of your app on App Store Connect without touching " \ "any other metadata, screenshots, or binaries. Useful for CI pipelines that need " \ "to update age ratings independently of an app release. Supports both API key " \ "and Apple ID authentication." end |
.example_code ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 139 def self.example_code [ '# Using App Store Connect API key (recommended for CI) update_app_age_rating( api_key_path: "fastlane/api_key.json", app_identifier: "com.example.app", age_rating_config_path: "fastlane/metadata/age_rating.json" )', '# Using Apple ID update_app_age_rating( username: "user@example.com", app_identifier: "com.example.app", age_rating_config_path: "fastlane/metadata/age_rating.json", team_id: "ABC123456" )', '# Using the api_key hash returned by app_store_connect_api_key action api_key = app_store_connect_api_key( key_id: "D383SF739", issuer_id: "6053b7fe-68a8-4acb-89be-165aa6465141", key_filepath: "./AuthKey_D383SF739.p8" ) update_app_age_rating( api_key: api_key, app_identifier: "com.example.app", age_rating_config_path: "fastlane/metadata/age_rating.json" )' ] end |
.is_supported?(platform) ⇒ Boolean
rubocop:disable Naming/PredicateName
180 181 182 183 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 180 def self.is_supported?(platform) # rubocop:disable Naming/PredicateName # fastlane's Action interface mandates the method name `is_supported?` %i[ios mac tvos].include?(platform) end |
.return_value ⇒ Object
176 177 178 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 176 def self.return_value "Returns true if the age rating was successfully updated" end |
.run(params) ⇒ Object
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'fastlane/lib/fastlane/actions/update_app_age_rating.rb', line 79 def self.run(params) require 'spaceship' require 'json' # Honour an API key that was set by app_store_connect_api_key earlier in the lane params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY] # Authenticate: API key takes priority, falls back to Apple ID session token = Spaceship::ConnectAPI::Token.from( hash: params[:api_key], filepath: params[:api_key_path] ) if token UI.("Creating authorization token for App Store Connect API") Spaceship::ConnectAPI.token = token else UI.("Login to App Store Connect (#{params[:username]})") Spaceship::ConnectAPI.login( params[:username], nil, use_portal: false, use_tunes: true, team_id: params[:team_id], team_name: params[:team_name] ) end # Find the app by bundle identifier app = Spaceship::ConnectAPI::App.find(params[:app_identifier]) UI.user_error!("Could not find app with identifier '#{params[:app_identifier]}'") unless app # Fetch the editable app info app_info = app.fetch_edit_app_info unless app_info UI.user_error!( "Could not fetch editable app info for '#{params[:app_identifier]}'. " \ "Ensure the app is in an editable state in App Store Connect." ) end # Parse age rating config and map ITC keys to ASC keys config_json = parse_config(params[:age_rating_config_path]) attributes = build_attributes(config_json) # Fetch and update the age rating declaration = app_info. UI.user_error!("Could not fetch age rating declaration for '#{params[:app_identifier]}'") unless UI.("Updating age rating for '#{params[:app_identifier]}'...") .update(attributes: attributes) UI.success("Successfully updated age rating for '#{params[:app_identifier]}'") true end |