Class: Fastlane::Actions::AppStoreConnectApiKeyAddToRemoteAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AppStoreConnectApiKeyAddToRemoteAction
- Defined in:
- lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
106 107 108 |
# File 'lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb', line 106 def self. ["Dima Vorona", "Yalantis"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb', line 58 def self. [ FastlaneCore::ConfigItem.new( key: :git_repo_url, env_name: "APP_STORE_CONNECT_API_KEY_GIT_REPO_URL", description: "Git repo URL where AppStore Connect's Api Key should be stored in", type: String ), FastlaneCore::ConfigItem.new( key: :git_repo_branch, env_name: "APP_STORE_CONNECT_API_KEY_GIT_REPO_BRANCH", description: "Git repo branch where AppStore Connect's Api Key should be stored in", type: String, default_value: 'master' ), 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_id, env_name: "APP_STORE_CONNECT_API_KEY_KEY_ID", description: "The key ID", ), 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: [:key_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 ) ] end |
.description ⇒ Object
54 55 56 |
# File 'lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb', line 54 def self.description "Add/Update AppStore Connect API Key to the remote git repo" end |
.is_supported?(platform) ⇒ Boolean
110 111 112 |
# File 'lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb', line 110 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.run(options) ⇒ Object
8 9 10 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 47 48 |
# File 'lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_add_to_remote.rb', line 8 def self.run() git_repo_url = [:git_repo_url] git_repo_branch = [:git_repo_branch] key_filepath = [:key_filepath] key_id = [:key_id] key_content = [:key_content] is_key_content_base64 = [:is_key_content_base64] if key_content.nil? && key_filepath.nil? UI.user_error!(":key_content or :key_filepath is required") end Helper::GitHelper.clone_repo_in_tmp(repo_url: git_repo_url, branch: git_repo_branch, create_branch: true) do |dir| target_filename = "#{key_id}.p8" target_filepath = File.join(dir, target_filename) if key_filepath.nil? == false FileUtils.cp(File.(key_filepath), target_filepath) else File.open(target_filepath, 'w') do |file| if is_key_content_base64 file.write(Base64.decode64(key_content)) else file.write(key_content) end end end repo_status = Actions.sh("git status --porcelain") repo_clean = repo_status.empty? if repo_clean UI.("Skipping key #{key_id} update since it contents remains the same") else UI.("Adding / updating #{key_id}") Actions.sh("git add #{target_filename} && git commit -m '[AppStore Connect API Key] Add/Update #{target_filename} key'") Actions.sh("git push -f #{git_repo_url} #{git_repo_branch}") end end end |