Class: Fastlane::Actions::LatestPlayStoreVersionCodeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::LatestPlayStoreVersionCodeAction
- Defined in:
- lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_type ⇒ Object
- .return_value ⇒ Object
- .sample_return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
109 110 111 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 109 def self. ["jorgenpt"] end |
.available_options ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 75 def self. require 'supply' require 'supply/options' = Supply::Options..clone = [:package_name, :track, :json_key, :json_key_data, :key, :issuer, :root_url, :timeout] .delete_if { |option| .include?(option.key) == false } << FastlaneCore::ConfigItem.new(key: :release_name, env_name: "LATEST_RELEASE_NAME", description: "The release name whose latest version code we want", optional: true) << FastlaneCore::ConfigItem.new(key: :initial_version_code, env_name: "INITIAL_VERSION_CODE", description: "sets the version code to given value if no release is found", default_value: 1, skip_type_validation: true) # allow Integer, String end |
.category ⇒ Object
127 128 129 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 127 def self.category :production end |
.description ⇒ Object
64 65 66 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 64 def self.description "Fetches most recent version code from the Google Play Store" end |
.details ⇒ Object
68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 68 def self.details [ "Provides a way to retrieve the latest version code & release name published to Google Play.", "Fetches the most recent version code from the given track on Google Play." ].join("\n") end |
.example_code ⇒ Object
117 118 119 120 121 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 117 def self.example_code [ 'latest_play_store_version_code(release_name: "1.3")', ] end |
.is_supported?(platform) ⇒ Boolean
113 114 115 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 113 def self.is_supported?(platform) [:android].include?(platform) end |
.output ⇒ Object
94 95 96 97 98 99 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 94 def self.output [ ['LATEST_PLAY_STORE_VERSION_CODE', 'The latest version code of the latest version of the app uploaded to Google Play'], ['LATEST_PLAY_STORE_RELEASE_NAME', 'The release name of the version code'] ] end |
.return_type ⇒ Object
105 106 107 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 105 def self.return_type :int end |
.return_value ⇒ Object
101 102 103 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 101 def self.return_value "Integer representation of the latest version code uploaded to Google Play Store" end |
.run(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 11 def self.run(params) require 'supply' require 'supply/client' Supply.config = params client = Supply::Client.make_from_config client.begin_edit(package_name: Supply.config[:package_name]) track = client.tracks.find { |track| track.track == params[:track] } client.abort_current_edit if track.nil? UI.error("Could not find the track #{params[:track]} on Google Play, do you need to upload a first build?") exit(1) end release_name = params[:release_name] if release_name release = track.releases.find { |release| release.name == release_name } releases = if release.nil? then [] else [release] end = "release #{release_name}" else releases = track.releases = "any releases" end if releases.empty? UI.error("Could not find #{} for #{params[:track]} on Google Play, do you need to upload a first build?") exit(1) end release = releases.max { |a, b| a.version_codes.map(&:to_i).max <=> b.version_codes.map(&:to_i).max } release_name = release.name latest_version_code = release.version_codes.map(&:to_i).max if latest_version_code.nil? if params[:initial_version_code].nil? UI.error("Could not find any version codes for #{release.name} (track '#{params[:track]}') on Google Play.") exit(1) else latest_version_code = params[:initial_version_code].to_i end end Actions.lane_context[SharedValues::LATEST_PLAY_STORE_VERSION_CODE] = latest_version_code Actions.lane_context[SharedValues::LATEST_PLAY_STORE_RELEASE_NAME] = release_name return Actions.lane_context[SharedValues::LATEST_PLAY_STORE_VERSION_CODE] end |
.sample_return_value ⇒ Object
123 124 125 |
# File 'lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb', line 123 def self.sample_return_value 2 end |