Search code examples
iosapp-store-connectfastlane

How to get apps names and its live versions using fastlane


I need to make a report with apps names and it's live versions. my apple id is assigned as an admin in multiple teams and I need to loop over all apps inside every appstore team and get its name and live version.

I could get apps names and versions only for one development team using following script now I need to get it for all development teams that my apple id is assigned to.

lane :get_apps_names_and_versions do |options|
  require "spaceship" 
  all_apps = ""
  Spaceship::Tunes::Application.all.collect do |app|
  all_apps << "#{app.name} #{app.live_version.version} \n"
  end
  File.write('all_apps', all_apps[0..-3])
end 

Solution

  • I just did it by get all teams and loop over them then get apps for each team.

    lane :get_apps_names_and_versions do |options|
      require "spaceship" 
      clientTunes = Spaceship::Tunes.login(options[:appleID],options[:password])
      all_apps = ""
        clientTunes.teams.each do |team|
          ENV['FASTLANE_ITC_TEAM_ID'] = "#{team['contentProvider']['contentProviderId']}"
          Spaceship::Tunes.select_team
          Spaceship::Tunes::Application.all.collect do |app| 
            begin
              live_version = app.live_version.version 
              all_apps << "#{app.name} #{live_version} #{app.bundle_id}\n"
              UI.message "#{app.name} #{live_version} #{app.bundle_id}\n"
              rescue
                all_apps << "#{app.name} NO Live Version \n"
                UI.message "#{app.name} NO Live Version \n"
              end
            end
          end 
      File.write('all_apps', all_apps[0..-3])
      end