Class: Fastlane::Helper::UploadHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/connected/helper/connected_helper.rb

Class Method Summary collapse

Class Method Details

.upload_app(ipa_file, api_key, issuer_id, key_id, xcode_path) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/fastlane/plugin/connected/helper/connected_helper.rb', line 112

def self.upload_app(ipa_file, api_key, issuer_id, key_id, xcode_path)
  # Save auth key to file
  connect_keys_dir = "#{ENV['HOME']}/.appstoreconnect"
  Dir.mkdir(connect_keys_dir) unless File.exist?(connect_keys_dir)
  key_dir = "#{connect_keys_dir}/private_keys"
  Dir.mkdir(key_dir) unless File.exist?(key_dir)

  key_path = "#{key_dir}/AuthKey_#{key_id}.p8"
  out_file = File.new(key_path, "w+")
  out_file.puts(api_key)
  out_file.close

  # Start upload
  altool_path = "#{xcode_path}/Contents/Developer/usr/bin/altool"
  Fastlane::Actions.sh(altool_path, "--upload-app", "--type", "ios", "--file", ipa_file, "--apiKey", key_id, "--apiIssuer", issuer_id)
end