class Fastlane::Actions::AppStoreConnectApiKeySetFromRemoteAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 82
def self.authors
  ["Dima Vorona", "Yalantis"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 43
def self.available_options
  [
      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_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: :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
      )
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 39
def self.description
  "Add/Update AppStore Connect API Key to the remote git repo"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 86
def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end
output() click to toggle source
# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 78
def self.output
  Fastlane::Actions::AppStoreConnectApiKeyAction.output
end
run(options) click to toggle source
# File lib/fastlane/plugin/yalantis_ci/actions/app_store_connect_api_key_set_from_remote.rb, line 7
def self.run(options)
  git_repo_url = options[:git_repo_url]
  git_repo_branch = options[:git_repo_branch]

  key_id = options[:key_id]
  issuer_id = options[:issuer_id]
  in_house = options[:in_house]
  
  Helper::GitHelper.clone_repo_in_tmp(git_repo_url, git_repo_branch) do |dir|
    target_filename = "#{key_id}.p8"
    target_filepath = Pathname.new File.join(dir, target_filename)
  
    if target_filepath.exist?
      UI.message("Setting contents of #{target_filename} as a API Key")
      
      Fastlane::Actions::AppStoreConnectApiKeyAction.run(
          key_id: key_id, 
          issuer_id: issuer_id, 
          key_content: Base64.encode64(target_filepath.read), 
          is_key_content_base64: true,
          in_house: in_house
      )
    else
      UI.user_error!("No #{target_filename} has been found at #{git_repo_url}")
    end
  end
end