sigh/lib/sigh/download_all.rb in fastlane_hotfix-2.165.1 vs sigh/lib/sigh/download_all.rb in fastlane_hotfix-2.187.0
- old
+ new
@@ -7,13 +7,15 @@
module Sigh
class DownloadAll
# Download all valid provisioning profiles
def download_all(download_xcode_profiles: false)
- if (token = api_token)
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: Sigh.config[:api_key], filepath: Sigh.config[:api_key_path]))
UI.message("Creating authorization token for App Store Connect API")
- Spaceship::ConnectAPI.token = token
+ Spaceship::ConnectAPI.token = api_token
+ elsif !Spaceship::ConnectAPI.token.nil?
+ UI.message("Using existing authorization token for App Store Connect API")
else
# Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
# Prompts select team if multiple teams and none specified
UI.message("Starting login with user '#{Sigh.config[:username]}'")
Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
@@ -55,15 +57,9 @@
# Filtering on 'profileType' seems to be undocumented as of 2020-07-30
# but works on both web session and official API
profiles = Spaceship::ConnectAPI::Profile.all(filter: { profileType: profile_types.join(",") }, includes: "bundleId")
download_profiles(profiles)
- end
-
- def api_token
- api_token ||= Spaceship::ConnectAPI::Token.create(Sigh.config[:api_key]) if Sigh.config[:api_key]
- api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Sigh.config[:api_key_path]) if Sigh.config[:api_key_path]
- return api_token
end
# @param profiles [Array] Array of all the provisioning profiles we want to download
def download_profiles(profiles)
UI.important("No profiles available for download") if profiles.empty?