fastlane-plugin-latest_play_store_version_code 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 53e2d8bfbe2820dfd0db66b752abbb344f6e9978cf78dc04cad8311b320648ff
4
+ data.tar.gz: 19ce1cf0fd1d6faa6e9c87e020d87746a21cc0dcdaa9a1321d2c384bd372f39a
5
+ SHA512:
6
+ metadata.gz: 496275944e4049a074484c8b0cfe086e709b94176e2a7a062183c31384e4a537a9ee20c0e2fc461307237514987e4458b444d55c646c2eda013bf321714ce91a
7
+ data.tar.gz: 15891ad864bc297e0035d6da0696e51fb7c00e25dab64ed00cc7256a59f4c9c987c79b78586ce202e4e405b9b77f142f1e472dddc945b8b21114bacd7e607334
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Jørgen P. Tjernø <jorgen@tjer.no>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # latest_play_store_version_code plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-latest_play_store_version_code)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-latest_play_store_version_code`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin latest_play_store_version_code
11
+ ```
12
+
13
+ ## About latest_play_store_version_code
14
+
15
+ Adds a latest_play_store_version_code action to fetch the latest Google Play Store version code for your project.
16
+
17
+ ## Example
18
+
19
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
20
+
21
+ ## Run tests for this plugin
22
+
23
+ To run code style validation, run
24
+
25
+ ```
26
+ rake
27
+ ```
28
+
29
+ To automatically fix many of the styling issues, use
30
+
31
+ ```
32
+ rubocop -a
33
+ ```
34
+
35
+ ## Issues and Feedback
36
+
37
+ For any other issues and feedback about this plugin, please submit it to this repository.
38
+
39
+ ## Troubleshooting
40
+
41
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
42
+
43
+ ## Using _fastlane_ Plugins
44
+
45
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
46
+
47
+ ## About _fastlane_
48
+
49
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,130 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/latest_play_store_version_code_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ LATEST_PLAY_STORE_VERSION_CODE = :LATEST_PLAY_STORE_VERSION_CODE
8
+ LATEST_PLAY_STORE_RELEASE_NAME = :LATEST_PLAY_STORE_RELEASE_NAME
9
+ end
10
+
11
+ class LatestPlayStoreVersionCodeAction < Action
12
+ def self.run(params)
13
+ require 'supply'
14
+ require 'supply/client'
15
+
16
+ Supply.config = params
17
+ client = Supply::Client.make_from_config
18
+
19
+ client.begin_edit(package_name: Supply.config[:package_name])
20
+ track = client.tracks.find { |track| track.track == params[:track] }
21
+ client.abort_current_edit
22
+
23
+ if track.nil?
24
+ UI.error("Could not find the track #{params[:track]} on Google Play, do you need to upload a first build?")
25
+ exit(1)
26
+ end
27
+
28
+ release_name = params[:release_name]
29
+ if release_name
30
+ release = track.releases.find { |release| release.name == release_name }
31
+ release_message = "release #{release_name}"
32
+ else
33
+ release = track.releases.last
34
+ release_message = "any releases"
35
+ end
36
+
37
+ if release.nil?
38
+ UI.error("Could not find #{release_message} for #{params[:track]} on Google Play, do you need to upload a first build?")
39
+ exit(1)
40
+ end
41
+
42
+ release_name = release.name
43
+ latest_version_code = release.version_codes.last
44
+ if latest_version_code.nil?
45
+ if params[:initial_version_code].nil?
46
+ UI.error("Could not find any version codes for #{release.name} (track '#{params[:track]}') on Google Play.")
47
+ exit(1)
48
+ else
49
+ latest_version_code = params[:initial_version_code].to_s
50
+ end
51
+ end
52
+
53
+ Actions.lane_context[SharedValues::LATEST_PLAY_STORE_VERSION_CODE] = latest_version_code.to_i
54
+ Actions.lane_context[SharedValues::LATEST_PLAY_STORE_RELEASE_NAME] = release_name
55
+ return Actions.lane_context[SharedValues::LATEST_PLAY_STORE_VERSION_CODE]
56
+ end
57
+
58
+ #####################################################
59
+ # @!group Documentation
60
+ #####################################################
61
+
62
+ def self.description
63
+ "Fetches most recent version code from the Google Play Store"
64
+ end
65
+
66
+ def self.details
67
+ [
68
+ "Provides a way to retrieve the latest version code & release name published to Google Play.",
69
+ "Fetches the most recent version code from the given track on Google Play."
70
+ ].join("\n")
71
+ end
72
+
73
+ def self.available_options
74
+ require 'supply'
75
+ require 'supply/options'
76
+ options = Supply::Options.available_options.clone
77
+
78
+ options_to_keep = [:package_name, :track, :json_key, :json_key_data, :root_url, :timeout]
79
+ options.delete_if { |option| options_to_keep.include?(option.key) == false }
80
+
81
+ options << FastlaneCore::ConfigItem.new(key: :release_name,
82
+ env_name: "LATEST_RELEASE_NAME",
83
+ description: "The release name whose latest version code we want",
84
+ optional: true)
85
+ options << FastlaneCore::ConfigItem.new(key: :initial_version_code,
86
+ env_name: "INITIAL_VERSION_CODE",
87
+ description: "sets the version code to given value if no release is found",
88
+ default_value: 1,
89
+ skip_type_validation: true) # allow Integer, String
90
+ end
91
+
92
+ def self.output
93
+ [
94
+ ['LATEST_PLAY_STORE_VERSION_CODE', 'The latest version code of the latest version of the app uploaded to Google Play'],
95
+ ['LATEST_PLAY_STORE_RELEASE_NAME', 'The release name of the version code']
96
+ ]
97
+ end
98
+
99
+ def self.return_value
100
+ "Integer representation of the latest version code uploaded to Google Play Store"
101
+ end
102
+
103
+ def self.return_type
104
+ :int
105
+ end
106
+
107
+ def self.authors
108
+ ["jorgenpt"]
109
+ end
110
+
111
+ def self.is_supported?(platform)
112
+ [:android].include?(platform)
113
+ end
114
+
115
+ def self.example_code
116
+ [
117
+ 'latest_play_store_version_code(release_name: "1.3")',
118
+ ]
119
+ end
120
+
121
+ def self.sample_return_value
122
+ 2
123
+ end
124
+
125
+ def self.category
126
+ :production
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module LatestPlayStoreVersionCode
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/latest_play_store_version_code/version'
2
+
3
+ module Fastlane
4
+ module LatestPlayStoreVersionCode
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::LatestPlayStoreVersionCode.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-latest_play_store_version_code
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jørgen P. Tjernø
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fastlane
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.209.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.209.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec_junit_formatter
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.12.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.12.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-require_tools
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email: jorgen@tjer.no
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/latest_play_store_version_code.rb
162
+ - lib/fastlane/plugin/latest_play_store_version_code/actions/latest_play_store_version_code_action.rb
163
+ - lib/fastlane/plugin/latest_play_store_version_code/version.rb
164
+ homepage: https://github.com/jorgenpt/fastlane-plugin-latest_play_store_version_code
165
+ licenses:
166
+ - MIT
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '2.6'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubygems_version: 3.3.7
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: Adds a latest_play_store_version_code action to fetch the latest Google Play
187
+ Store version code for your project.
188
+ test_files: []