Class: Fastlane::Actions::AppStoreConnectApiKeyAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::AppStoreConnectApiKeyAction
- Defined in:
- fastlane/lib/fastlane/actions/app_store_connect_api_key.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(options) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
107 108 109 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 107 def self. ["joshdholtz"] end |
.available_options ⇒ Object
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 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 52 def self. [ FastlaneCore::ConfigItem.new(key: :key_id, env_name: "APP_STORE_CONNECT_API_KEY_KEY_ID", description: "The key ID"), FastlaneCore::ConfigItem.new(key: :issuer_id, env_name: "APP_STORE_CONNECT_API_KEY_ISSUER_ID", description: "The issuer ID"), FastlaneCore::ConfigItem.new(key: :key_filepath, env_name: "APP_STORE_CONNECT_API_KEY_KEY_FILEPATH", description: "The path to the key p8 file", optional: true, conflicting_options: [:key_content], verify_block: proc do |value| UI.user_error!("Couldn't find key p8 file at path '#{value}'") unless File.exist?(File.(value)) end), FastlaneCore::ConfigItem.new(key: :key_content, env_name: "APP_STORE_CONNECT_API_KEY_KEY", description: "The content of the key p8 file", sensitive: true, optional: true, conflicting_options: [:filepath]), FastlaneCore::ConfigItem.new(key: :is_key_content_base64, env_name: "APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64", description: "Whether :key_content is Base64 encoded or not", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :duration, env_name: "APP_STORE_CONNECT_API_KEY_DURATION", description: "The token session duration", optional: true, default_value: Spaceship::ConnectAPI::Token::DEFAULT_TOKEN_DURATION, type: Integer, verify_block: proc do |value| UI.user_error!("The duration can't be more than 1200 (20 minutes) and the value entered was '#{value}'") unless value <= 1200 end), FastlaneCore::ConfigItem.new(key: :in_house, env_name: "APP_STORE_CONNECT_API_KEY_IN_HOUSE", description: "Is App Store or Enterprise (in house) team? App Store Connect API cannot determine this on its own (yet)", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :set_spaceship_token, env_name: "APP_STORE_CONNECT_API_KEY_SET_SPACESHIP_TOKEN", description: "Authorizes all Spaceship::ConnectAPI requests by automatically setting Spaceship::ConnectAPI.token", type: Boolean, default_value: true) ] end |
.category ⇒ Object
143 144 145 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 143 def self.category :app_store_connect end |
.description ⇒ Object
48 49 50 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 48 def self.description "Load the App Store Connect API token to use in other fastlane tools and actions" end |
.details ⇒ Object
115 116 117 118 119 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 115 def self.details [ "Load the App Store Connect API token to use in other fastlane tools and actions" ].join("\n") end |
.example_code ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 121 def self.example_code [ 'app_store_connect_api_key( key_id: "D83848D23", issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f", key_filepath: "D83848D23.p8" )', 'app_store_connect_api_key( key_id: "D83848D23", issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f", key_filepath: "D83848D23.p8", duration: 200, in_house: true )', 'app_store_connect_api_key( key_id: "D83848D23", issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f", key_content: "-----BEGIN EC PRIVATE KEY-----\nfewfawefawfe\n-----END EC PRIVATE KEY-----" )' ] end |
.is_supported?(platform) ⇒ Boolean
111 112 113 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 111 def self.is_supported?(platform) [:ios, :mac, :tvos].include?(platform) end |
.output ⇒ Object
101 102 103 104 105 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 101 def self.output [ ['APP_STORE_CONNECT_API_KEY', 'The App Store Connect API key information used for authorization requests. This hash can be passed directly into the :api_key options on other tools or into Spaceship::ConnectAPI::Token.create method'] ] end |
.run(options) ⇒ Object
11 12 13 14 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 |
# File 'fastlane/lib/fastlane/actions/app_store_connect_api_key.rb', line 11 def self.run() key_id = [:key_id] issuer_id = [:issuer_id] key_content = [:key_content] is_key_content_base64 = [:is_key_content_base64] key_filepath = [:key_filepath] duration = [:duration] in_house = [:in_house] if key_content.nil? && key_filepath.nil? UI.user_error!(":key_content or :key_filepath is required") end # New lines don't get read properly when coming from an ENV # Replacing them literal version with a new line key_content = key_content.gsub('\n', "\n") if key_content # This hash matches the named arguments on # the Spaceship::ConnectAPI::Token.create method key = { key_id: key_id, issuer_id: issuer_id, key: key_content || File.binread(File.(key_filepath)), is_key_content_base64: is_key_content_base64, duration: duration, in_house: in_house } Actions.lane_context.set_sensitive(SharedValues::APP_STORE_CONNECT_API_KEY, key) # Creates Spaceship API Key session # User does not need to pass the token into any actions because of this Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(**key) if [:set_spaceship_token] return key end |