fastlane-plugin-get_new_build_number 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c90e78136c51a621e69f71d95ec3eb015895652949041603ccd3cad27bf4ab4
4
- data.tar.gz: 1c8c730ee099a35ac0a28a74410d350f4a54f6e999da11c0e38e092d1e632c4f
3
+ metadata.gz: a8e2528a341eb84b6b0c9ab295e585a60163a260ceda14d74a8cc31d16bcc5e3
4
+ data.tar.gz: 72960821aa6f1b7a18da431ca3528d476307317d8309d6efee2b6301532fd6d4
5
5
  SHA512:
6
- metadata.gz: 7155f7c2b9055a367d0b3a11d010b275070426c70e82724bd2c65cd21de5d4540bbb8ffe73aca002fc769017c29558c36d8b9e3bd6ca42d8998378d922fabd95
7
- data.tar.gz: d07f9e690bba3ad23a98c9d56219a75b014a7513c1b0efd8007db30693f755189db914b547f0dacd3bc8d2baad1abadb1e5ac177d18fdf9011d0b703d5315efe
6
+ metadata.gz: 126448527f46d456eceff761a9c2944d81c017d59f76e9f1d175c368521230e0330e16c18ab73e36a2dcb98781d9b28f866ff7615c5cd84d67374dcd52e331ea
7
+ data.tar.gz: d5fe2a28a184e0ee80ad791070a08a412cbea9a97e1c31a5f404d4da256407d9fb6f386d812cc2b095b2df3b180c7402be160cdba9934df6df62b911dcc9c9c0
data/LICENSE CHANGED
@@ -1,21 +1,20 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Bartek Pacia <barpac02@gmail.com>
3
+ Copyright (c) 2022 Bartek Pacia @bartekpacia
4
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:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
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.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,52 +1,224 @@
1
1
  # get_new_build_number plugin
2
2
 
3
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-get_new_build_number)
3
+ [![fastlane Plugin Badge][fastlane-plugin-badge]][fastlane-plugin]
4
4
 
5
- ## Getting Started
5
+ I've often found myself wanting to _just assign new build number_ to my apps.
6
+ This simple task turns out to be harder that it seems at first. There's a
7
+ production build number (on App Store and Google Play), you might also have
8
+ separate build numbers for beta, alpha, and other versions of your app.
9
+
10
+ Fortunately, all of these services provide fastlane actions to get the latest
11
+ build number.
12
+
13
+ Unfortunately, every service provides app's build number in a bit different
14
+ format, which makes it not-so-straightforward to get the latest-latest version
15
+ number.
16
+
17
+ This is my take at automating this.
18
+
19
+ ### Features
20
+
21
+ Supported services:
22
+
23
+ - [x] App Store (via [app_store_build_number][app-store])
24
+ - [x] TestFlight (via [latest_testflight_build_number][testflight])
25
+ - [x] Google Play (via [google_play_track_version_codes][google-play])
26
+ - [x] Firebase App Distribution (via
27
+ [firebase_app_distribution_get_latest_release][fad])
28
+ - [ ] App Center (via [appcenter_fetch_version_number][app-center])
6
29
 
7
- This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-get_new_build_number`, add it to your project by running:
30
+ The _latest_ build number is persisted in
31
+ [$TMPDIR][ruby-tmpdir]`/latest_build_number.txt`, so you can use it across
32
+ `fastlane` invocations. For example, you could safely do:
8
33
 
9
34
  ```bash
35
+ $ cd ios && bundle exec fastlane prod && cd ..
36
+ $ cd android && bundle exec fastlane prod && cd ..
37
+ $ cd symbian && bundle exec fastlane prod && cd .. # lol
38
+ ```
39
+
40
+ The first `fastlane` invocation retrieves the _latest_ build number. Then, the 2
41
+ subsequent invocations simply reuse the _latest_ build number from the file.
42
+
43
+ The _new_ build number is derived using this complex forumla:
44
+
45
+ ```
46
+ new_build_number = latest_build_number + 1
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Example 1
52
+
53
+ Simple use case. This will only take the latest version from Google Play. This
54
+ might not seem very useful at first, but is _is_ when you have different version
55
+ codes for different tracks (`production`, `beta`, `alpha`, `internal`).
56
+
57
+ Let's say that your Play Console looks like this:
58
+
59
+ - `production` is at version code `60`
60
+ - `beta` is at version code `61`
61
+ - `alpha` is at 2 version codes: `64` and `65` (becasue you're doing some fancy
62
+ testing)
63
+
64
+ In this case, `get_new_build_number` action would return `66` (because it is
65
+ newer/higher/bigger than all the other build numbers).
66
+
67
+ ```ruby
68
+ # android/fastlane/Fastfile
69
+
70
+ default_platform(:android)
71
+
72
+ platform :android do
73
+ desc "Deploy a new beta version to Google Play"
74
+ lane :beta do
75
+ build_number = get_new_build_number(
76
+ package_name: ENV["APP_PACKAGE_NAME"], # e.g com.example.yourapp
77
+ google_play_json_key_path: ENV["GOOGLE_PLAY_JSON_KEY_PATH"], # path to JSON key for authenticating with Google Play Android Developer API
78
+ ).to_s
79
+
80
+ build_android_app(
81
+ task: "bundleRelease",
82
+ project_dir: "..",
83
+ properties: {
84
+ "android.injected.version.code" => build_number,
85
+ },
86
+ )
87
+
88
+ upload_to_play_store(
89
+ track: "beta",
90
+ aab: "./build/outputs/bundle/release/android-release.aab",
91
+ json_key: ENV["GOOGLE_PLAY_JSON_KEY_PATH"],
92
+ )
93
+ end
94
+ end
95
+ ```
96
+
97
+ ### Example 2
98
+
99
+ If you provide more parameters, the plugin will take them into account. For
100
+ example, if you pass `bundle_identifier` to `get_new_build_number`:
101
+
102
+ ```ruby
103
+ platform :android do
104
+ desc "Deploy a new beta version to Google Play"
105
+ lane :beta do
106
+ build_number = get_new_build_number(
107
+ bundle_identifier: ENV["APP_BUNDLE_ID"], # e.g com.example.yourApp
108
+ package_name: ENV["APP_PACKAGE_NAME"], # e.g com.example.yourapp
109
+ google_play_json_key_path: ENV["GOOGLE_PLAY_JSON_KEY_PATH"], # path to JSON key for authenticating with Google Play Android Developer API
110
+ ).to_s
111
+
112
+ build_android_app(
113
+ task: "bundleRelease",
114
+ project_dir: "..",
115
+ properties: {
116
+ "android.injected.version.code" => build_number,
117
+ },
118
+ )
119
+
120
+ upload_to_play_store(
121
+ track: "beta",
122
+ aab: "./build/outputs/bundle/release/android-release.aab",
123
+ json_key: ENV["GOOGLE_PLAY_JSON_KEY_PATH"],
124
+ )
125
+ end
126
+ end
127
+ ```
128
+
129
+ then also build numbers in App Store will be taken into account.
130
+
131
+ Building on the previous example, let's say that your Play Console looks like
132
+ this (same as before):
133
+
134
+ - `production` is at version code `60`
135
+ - `beta` is at version code `61`
136
+ - `alpha` is at 2 version codes: `64` and `65` (becasue you're doing some fancy
137
+ testing)
138
+
139
+ And let's say that you App Store looks like this:
140
+
141
+ - production is live at version code `81`
142
+
143
+ In this case, `get_new_build_number` action would return `82` (because it is
144
+ newer/higher/bigger than all the other build numbers). Of course, you have to be
145
+ authenticated to App Store using
146
+ [app_store_connect_api_key][app-store-connect-api-key].
147
+
148
+ This makes it easy to keep version codes in sync in your app across different
149
+ app stores.
150
+
151
+ ### Important note
152
+
153
+ Please note that this action is simple and has no protection against concurrent
154
+ builds. Is is probably unsafe to use in an environment when many releases happen
155
+ in a short time frame.
156
+
157
+ ## Getting Started
158
+
159
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
160
+ get started with `fastlane-plugin-get_new_build_number`, add it to your project
161
+ by running:
162
+
163
+ ```
164
+
10
165
  fastlane add_plugin get_new_build_number
166
+
11
167
  ```
12
168
 
13
169
  ## About get_new_build_number
14
170
 
15
171
  Retrieves the new build number for your app.
16
172
 
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
173
+ This plugin provides a single action, `get_new_build_number`. For now, see
174
+ source code to learn how to use it. I might write some docs later.
18
175
 
19
176
  ## Example
20
177
 
21
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
178
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this
179
+ plugin. Try it by cloning the repo, running `fastlane install_plugins` and
180
+ `bundle exec fastlane test`.
22
181
 
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
182
+ **Note to author:** Please set up a sample project to make it easy for users to
183
+ explore what your plugin does. Provide everything that is necessary to try out
184
+ the plugin in this project (including a sample Xcode/Android project if
185
+ necessary)
24
186
 
25
187
  ## Run tests for this plugin
26
188
 
27
189
  To run both the tests, and code style validation, run
28
190
 
29
191
  ```
192
+
30
193
  rake
194
+
31
195
  ```
32
196
 
33
197
  To automatically fix many of the styling issues, use
198
+
34
199
  ```
200
+
35
201
  rubocop -a
202
+
36
203
  ```
37
204
 
38
205
  ## Issues and Feedback
39
206
 
40
- For any other issues and feedback about this plugin, please submit it to this repository.
207
+ For any other issues and feedback about this plugin, please submit it to this
208
+ repository.
41
209
 
42
210
  ## Troubleshooting
43
211
 
44
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
-
46
- ## Using _fastlane_ Plugins
47
-
48
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
-
50
- ## About _fastlane_
51
-
52
- _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).
212
+ If you have trouble using plugins, check out the [Plugins
213
+ Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/)
214
+ guide.
215
+
216
+ [fastlane-plugin-badge]: https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg
217
+ [fastlane-plugin]: https://rubygems.org/gems/fastlane-plugin-get_new_build_number
218
+ [ruby-tmpdir]: https://ruby-doc.org/stdlib-2.5.1/libdoc/tmpdir/rdoc/Dir.html#method-c-tmpdir
219
+ [app-store]: https://docs.fastlane.tools/actions/app_store_build_number
220
+ [testflight]: https://docs.fastlane.tools/actions/latest_testflight_build_number
221
+ [google-play]: https://docs.fastlane.tools/actions/google_play_track_version_codes
222
+ [fad]: https://github.com/fastlane/fastlane-plugin-firebase_app_distribution/blob/master/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb
223
+ [app-center]: https://github.com/microsoft/fastlane-plugin-appcenter/blob/master/lib/fastlane/plugin/appcenter/actions/appcenter_fetch_version_number.rb
224
+ [app-store-connect-api-key]: https://docs.fastlane.tools/actions/app_store_connect_api_key
@@ -14,38 +14,38 @@ module Fastlane
14
14
  UI.message("firebase_app_ios: #{params[:firebase_app_ios]}")
15
15
  UI.message("firebase_app_android: #{params[:firebase_app_android]}")
16
16
 
17
- file = "#{Dir.tmpdir}/highest_build_number.txt"
18
- UI.message "Temp file location: #{file}"
17
+ file = "#{Dir.tmpdir}/latest_build_number.txt"
18
+ UI.message("Temporary file location: #{file}")
19
19
 
20
- if(File.exist?(file))
21
- UI.success "File with new number file exists. Reading build number from it..."
22
- highest_build_number = File.read(file).to_i
23
- else
24
- UI.message "File with new build number does not exist. New build number will be "\
25
- "retrieved and file with it will be created."
26
- highest_build_number = Helper::GetNewBuildNumberHelper.get_highest_build_number(
20
+ if File.exist?(file)
21
+ UI.success("File with new number file exists. Reading build number from it...")
22
+ latest_build_number = File.read(file).to_i
23
+ else
24
+ UI.message("File with new build number does not exist. New build number will be "\
25
+ "retrieved and temporary file with it will be created.")
26
+ latest_build_number = Helper::GetNewBuildNumberHelper.get_latest_build_number(
27
27
  bundle_identifier: params[:bundle_identifier],
28
28
  package_name: params[:package_name],
29
29
  google_play_json_key_path: params[:google_play_json_key_path],
30
30
  firebase_json_key_path: params[:firebase_json_key_path],
31
31
  firebase_app_ios: params[:firebase_app_ios],
32
- firebase_app_android: params[:firebase_app_android],
32
+ firebase_app_android: params[:firebase_app_android]
33
33
  )
34
-
34
+
35
35
  File.open(file, "w") do |f|
36
- f.write "#{highest_build_number}\n"
37
- UI.message "Wrote #{highest_build_number} to #{file}"
36
+ f.write("#{latest_build_number}\n")
37
+ UI.message("Wrote #{latest_build_number} to #{file}")
38
38
  end
39
39
  end
40
40
 
41
- UI.success "Highest build number: #{highest_build_number}"
41
+ UI.success("Latest build number: #{latest_build_number}")
42
42
 
43
- if highest_build_number.is_a? Integer
44
- new_highest_build_number = highest_build_number + 1
45
- UI.success "New build number: #{new_highest_build_number}"
46
- return new_highest_build_number
43
+ if latest_build_number.kind_of?(Integer)
44
+ new_latest_build_number = latest_build_number + 1
45
+ UI.success("New build number: #{new_latest_build_number}")
46
+ return new_latest_build_number
47
47
  else
48
- UI.error "Highest build number is not an Integer"
48
+ UI.error("Latest build number is not an Integer")
49
49
  return nil
50
50
 
51
51
  end
@@ -60,7 +60,7 @@ module Fastlane
60
60
  end
61
61
 
62
62
  def self.return_value
63
- "An integer representing a new build number. It's the highest build "\
63
+ "An integer representing a new build number. It's the latest build "\
64
64
  "number collected from all services (e.g App Store, Google Play, App "\
65
65
  "Center) plus 1."
66
66
  end
@@ -77,43 +77,43 @@ module Fastlane
77
77
  env_name: "APP_BUNDLE_ID",
78
78
  description: "iOS bundle identifier",
79
79
  optional: true,
80
- type: String,
80
+ type: String
81
81
  ),
82
82
  FastlaneCore::ConfigItem.new(
83
83
  key: :package_name,
84
84
  env_name: "APP_PACKAGE_NAME",
85
85
  description: "Android package name",
86
86
  optional: true,
87
- type: String,
87
+ type: String
88
88
  ),
89
89
  FastlaneCore::ConfigItem.new(
90
90
  key: :google_play_json_key_path,
91
91
  env_name: "GOOGLE_PLAY_JSON_KEY_PATH",
92
92
  description: "Path to the Google Play Android Developer JSON key",
93
93
  optional: true,
94
- type: String,
94
+ type: String
95
95
  ),
96
96
  FastlaneCore::ConfigItem.new(
97
97
  key: :firebase_json_key_path,
98
98
  env_name: "FIREBASE_JSON_KEY_PATH",
99
99
  description: "Path to the Firebase Admin JSON key",
100
100
  optional: true,
101
- type: String,
101
+ type: String
102
102
  ),
103
103
  FastlaneCore::ConfigItem.new(
104
104
  key: :firebase_app_ios,
105
105
  env_name: "FIREBASE_APP_IOS",
106
106
  description: "Firebase iOS app ID",
107
107
  optional: true,
108
- type: String,
108
+ type: String
109
109
  ),
110
110
  FastlaneCore::ConfigItem.new(
111
111
  key: :firebase_app_android,
112
112
  env_name: "FIREBASE_APP_ANDROID",
113
113
  description: "Firebase Android app ID",
114
114
  optional: true,
115
- type: String,
116
- ),
115
+ type: String
116
+ )
117
117
  ]
118
118
  end
119
119
 
@@ -2,26 +2,25 @@ require 'fastlane_core/ui/ui'
2
2
  require 'tmpdir'
3
3
 
4
4
  module Fastlane
5
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
6
6
 
7
7
  module Helper
8
8
  class GetNewBuildNumberHelper
9
-
10
- def self.get_highest_build_number(
11
- bundle_identifier:nil,
12
- package_name:nil,
13
- google_play_json_key_path:nil,
14
- firebase_json_key_path:nil,
15
- firebase_app_ios:nil,
16
- firebase_app_android:nil
9
+ def self.get_latest_build_number(
10
+ bundle_identifier: nil,
11
+ package_name: nil,
12
+ google_play_json_key_path: nil,
13
+ firebase_json_key_path: nil,
14
+ firebase_app_ios: nil,
15
+ firebase_app_android: nil
17
16
  )
18
17
  if bundle_identifier.nil? && package_name.nil?
19
- UI.error "Both bundle_identifier and package_name are nil"
18
+ UI.error("Both bundle_identifier and package_name are nil")
20
19
  return nil
21
20
  end
22
21
 
23
22
  if package_name.nil? && google_play_json_key_path.nil?
24
- UI.error "Both package_name and google_play_json_key_path are nil"
23
+ UI.error("Both package_name and google_play_json_key_path are nil")
25
24
  return nil
26
25
  end
27
26
 
@@ -29,87 +28,86 @@ module Fastlane
29
28
  unless bundle_identifier.nil?
30
29
  app_store_build_number = Fastlane::Actions::AppStoreBuildNumberAction.run(
31
30
  app_identifier: bundle_identifier,
32
- platform: "IOS",
33
- )
31
+ platform: "IOS"
32
+ )
34
33
 
35
- UI.message "build number (App Store): #{app_store_build_number}"
34
+ UI.message("Latest build number (App Store): #{app_store_build_number}")
36
35
  end
37
36
 
38
- google_play_build_number_prod = get_version_code(
37
+ google_play_build_number_prod = get_google_play_build_number(
39
38
  track: "production",
40
39
  package_name: package_name,
41
- json_key: google_play_json_key_path,
40
+ json_key: google_play_json_key_path
42
41
  )
43
42
 
44
- google_play_build_number_beta = get_version_code(
43
+ google_play_build_number_beta = get_google_play_build_number(
45
44
  track: "beta",
46
45
  package_name: package_name,
47
- json_key: google_play_json_key_path,
46
+ json_key: google_play_json_key_path
48
47
  )
49
48
 
50
- google_play_build_number_alpha = get_version_code(
49
+ google_play_build_number_alpha = get_google_play_build_number(
51
50
  track: "alpha",
52
51
  package_name: package_name,
53
- json_key: google_play_json_key_path,
52
+ json_key: google_play_json_key_path
54
53
  )
55
54
 
56
- google_play_build_number_internal = get_version_code(
55
+ google_play_build_number_internal = get_google_play_build_number(
57
56
  track: "internal",
58
57
  package_name: package_name,
59
- json_key: google_play_json_key_path,
58
+ json_key: google_play_json_key_path
60
59
  )
61
60
 
62
61
  google_play_build_number = [
63
62
  google_play_build_number_prod,
64
63
  google_play_build_number_beta,
65
64
  google_play_build_number_alpha,
66
- google_play_build_number_internal,
65
+ google_play_build_number_internal
67
66
  ].max
68
67
 
69
- UI.message "build number (Google Play Store): #{google_play_build_number}"
68
+ UI.message("Latest build number (Google Play Store): #{google_play_build_number}")
70
69
 
71
70
  fad_build_number_ios = 0
72
71
  unless firebase_app_ios.nil?
73
72
  fad_build_number_ios = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
74
73
  app: firebase_app_ios,
75
- service_credentials_file: firebase_json_key_path,
74
+ service_credentials_file: firebase_json_key_path
76
75
  )[:buildVersion].to_i
77
-
78
- UI.message "build number (Firebase App Distribution iOS): #{fad_build_number_ios}"
76
+
77
+ UI.message("Latest build (Firebase App Distribution iOS): #{fad_build_number_ios}")
79
78
  end
80
79
 
81
80
  fad_build_number_android = 0
82
81
  unless firebase_app_android.nil?
83
82
  fad_build_number_android = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
84
83
  app: firebase_app_android,
85
- service_credentials_file: firebase_json_key_path,
84
+ service_credentials_file: firebase_json_key_path
86
85
  )[:buildVersion].to_i
87
86
 
88
- UI.message "build number (Firebase App Distribution Android): #{fad_build_number_android}"
87
+ UI.message("Latest build (Firebase App Distribution Android): #{fad_build_number_android}")
89
88
  end
90
89
 
91
90
  return [
92
91
  app_store_build_number,
93
92
  google_play_build_number,
94
93
  fad_build_number_ios,
95
- fad_build_number_android,
94
+ fad_build_number_android
96
95
  ].max
97
96
  end
98
97
 
99
- # Returns highest build number for the given track.
100
- def self.get_version_code(track:, package_name:, json_key:)
101
- begin
102
- codes = Fastlane::Actions::GooglePlayTrackVersionCodesAction.run(
103
- track: track,
104
- package_name: package_name,
105
- json_key: json_key,
106
- )
98
+ # Returns the latest build number ("version code", in Android terminology)
99
+ # for the given Google Play track.
100
+ def self.get_google_play_build_number(track:, package_name:, json_key:)
101
+ codes = Fastlane::Actions::GooglePlayTrackVersionCodesAction.run(
102
+ track: track,
103
+ package_name: package_name,
104
+ json_key: json_key
105
+ )
107
106
 
108
- return codes.max
109
- rescue
110
- UI.message "Version code not found for track #{track}"
111
- return 0
112
- end
107
+ return codes.max
108
+ rescue StandardError
109
+ UI.message("No build numbers found for track #{track}")
110
+ return 0
113
111
  end
114
112
  end
115
113
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GetNewBuildNumber
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-get_new_build_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Pacia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-29 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler