'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 1:[1]
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
Solution 2:[2]
If you're like me and wanted to obtain the live version without having to use the Spacehip login (e.g. in a CI/CD pipeline), and use the API key, you can do it like this:
app_store_build_number
live_version = lane_context[SharedValues::LATEST_VERSION]
Check the "Lane Variables" section: https://docs.fastlane.tools/actions/app_store_build_number/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mohamed Shaban |
| Solution 2 | Armin |
