Skip to content

Commit

Permalink
[deliver] update deliver/runner.rb to handle both ipa and pkg paths. (#…
Browse files Browse the repository at this point in the history
…20043)

* Update deliver/runner.rb to handle both ipa and pkg paths.

#19659

* Update runner.rb

* reformat

* Update runner.rb

* Updated verify to use same logic

* Fix verify message when no valid platform

Co-authored-by: Josh Holtz <me@joshholtz.com>
  • Loading branch information
snatchev and joshdholtz committed Jun 29, 2022
1 parent d407af5 commit 019bad7
Showing 1 changed file with 31 additions and 35 deletions.
66 changes: 31 additions & 35 deletions deliver/lib/deliver/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,35 +165,33 @@ def upload_metadata
def verify_binary
UI.message("Verifying binary with App Store Connect")

verify_ipa = options[:ipa]
verify_pkg = options[:pkg]

# 2020-01-27
# Only verify platform if if both ipa and pkg exists (for backwards support)
if verify_ipa && verify_pkg
verify_ipa = ["ios", "appletvos"].include?(options[:platform])
verify_pkg = options[:platform] == "osx"
end
ipa_path = options[:ipa]
pkg_path = options[:pkg]

platform = options[:platform]
transporter = transporter_for_selected_team

if verify_ipa
case platform
when "ios", "appletvos"
package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
ipa_path: options[:ipa],
ipa_path: ipa_path,
package_path: "/tmp",
platform: options[:platform]
platform: platform
)
elsif verify_pkg
result = transporter.verify(package_path: package_path)
when "osx"
package_path = FastlaneCore::PkgUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
pkg_path: options[:pkg],
pkg_path: pkg_path,
package_path: "/tmp",
platform: options[:platform]
platform: platform
)
result = transporter.verify(package_path: package_path)
else
UI.user_error!("No suitable file found for verify for platform: #{options[:platform]}")
end

transporter = transporter_for_selected_team
result = transporter.verify(package_path: package_path)

unless result
transporter_errors = transporter.displayable_errors
UI.user_error!("Error verifying the binary file: \n #{transporter_errors}")
Expand All @@ -204,35 +202,33 @@ def verify_binary
def upload_binary
UI.message("Uploading binary to App Store Connect")

upload_ipa = options[:ipa]
upload_pkg = options[:pkg]
ipa_path = options[:ipa]
pkg_path = options[:pkg]

# 2020-01-27
# Only verify platform if if both ipa and pkg exists (for backwards support)
if upload_ipa && upload_pkg
upload_ipa = ["ios", "appletvos"].include?(options[:platform])
upload_pkg = options[:platform] == "osx"
end
platform = options[:platform]
transporter = transporter_for_selected_team

if upload_ipa
case platform
when "ios", "appletvos"
package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
ipa_path: options[:ipa],
ipa_path: ipa_path,
package_path: "/tmp",
platform: options[:platform]
platform: platform
)
elsif upload_pkg
result = transporter.upload(package_path: package_path, asset_path: ipa_path)
when "osx"
package_path = FastlaneCore::PkgUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
pkg_path: options[:pkg],
pkg_path: pkg_path,
package_path: "/tmp",
platform: options[:platform]
platform: platform
)
result = transporter.upload(package_path: package_path, asset_path: pkg_path)
else
UI.user_error!("No suitable file found for upload for platform: #{options[:platform]}")
end

transporter = transporter_for_selected_team
result = transporter.upload(package_path: package_path, asset_path: upload_ipa || upload_pkg)

unless result
transporter_errors = transporter.displayable_errors
UI.user_error!("Error uploading ipa file: \n #{transporter_errors}")
Expand Down

0 comments on commit 019bad7

Please sign in to comment.