fastlane-plugin-get_new_build_number 0.2.5 → 0.2.8

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: 97cedbb3402e1f1e6f5ae410809064523c7d22685b06ec43a4ad9683ecec2b98
4
- data.tar.gz: d56de07c38399788a42568c6d6000a0c7418e7f9bcabb59609fe186b623f2314
3
+ metadata.gz: 89494ba57ca02a319cb02d1f0fa90de24812310918beae60f62665d663966f1c
4
+ data.tar.gz: e44fe6bb02df0976904c6033a13688ae5012b067edc30083e6697e05acb11b13
5
5
  SHA512:
6
- metadata.gz: 0622de5b803f4d24e5388bd8f77cf2b42901e3dcccbb0e094541975e61796a1b30b28e650112cd50f8708ddfd26c793dba514b3adb376ce829dd03d31d34e8bf
7
- data.tar.gz: 1f5c127d6e57871c3be3dac42863e4f3ef3da59e1f42965ab6078e619efec2069f65278695389d153e2ca404cb40a19bf519c890ab33fb8c02badb81499f72d5
6
+ metadata.gz: 13a38bd2b34ceb0f9f85d64341742db56628161fa0c753f0158386ffc58b957efe5252df69eef311dcd08f273cfc716081168dc593f3c908239808b455bd70d2
7
+ data.tar.gz: 81575a93738da5919faf47a31c1a56b2a6a5cba9bdfd60a5cae1ab22baa0b7d0b8a654fd711d3d303ea54f2115d78afbc0940b74e1f53c379c6d3a1ba97acf90
@@ -0,0 +1,26 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class GetNewBuildNameAction < Action
6
+ def self.run(params)
7
+ build_name = sh("git describe --tags --abbrev=0 | cut -c 2-").strip
8
+ UI.success("New build name: #{build_name}")
9
+ return build_name
10
+ end
11
+
12
+ def self.description
13
+ "Retrieves the new build number for your app."
14
+ end
15
+
16
+ def self.authors
17
+ ["Bartek Pacia"]
18
+ end
19
+
20
+ def self.return_value
21
+ "A string representing a new build name. It's the latest git tag with the first " \
22
+ "character stripped (so v4.2.0 becomes 4.2.0)"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -21,7 +21,7 @@ module Fastlane
21
21
  UI.success("File with new number file exists. Reading build number from it...")
22
22
  latest_build_number = File.read(file).to_i
23
23
  else
24
- UI.message("File with new build number does not exist. New build number will be " \
24
+ UI.important("File with new build number does not exist. New build number will be " \
25
25
  "retrieved and temporary file with it will be created.")
26
26
  latest_build_number = Helper::GetNewBuildNumberHelper.get_latest_build_number(
27
27
  bundle_identifier: params[:bundle_identifier],
@@ -68,25 +68,41 @@ module Fastlane
68
68
  ].max
69
69
 
70
70
  UI.message("Latest build number (Google Play Store): #{google_play_build_number}")
71
-
71
+
72
72
  fad_build_number_ios = 0
73
- unless firebase_app_ios.nil?
74
- fad_build_number_ios = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
75
- app: firebase_app_ios,
76
- service_credentials_file: firebase_json_key_path
77
- )[:buildVersion].to_i
78
-
79
- UI.message("Latest build (Firebase App Distribution iOS): #{fad_build_number_ios}")
73
+ begin
74
+ unless firebase_app_ios.nil?
75
+ response = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
76
+ app: firebase_app_ios,
77
+ service_credentials_file: firebase_json_key_path
78
+ )
79
+
80
+ unless response.nil?
81
+ fad_build_number_ios = response[:buildVersion].to_i
82
+ end
83
+
84
+ UI.message("Latest build (Firebase App Distribution iOS): #{fad_build_number_ios}")
85
+ end
86
+ rescue StandardError => e
87
+ UI.error("Error getting latest build number (Firebase App Distribution iOS): #{e.message}")
80
88
  end
81
89
 
82
90
  fad_build_number_android = 0
83
- unless firebase_app_android.nil?
84
- fad_build_number_android = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
85
- app: firebase_app_android,
86
- service_credentials_file: firebase_json_key_path
87
- )[:buildVersion].to_i
88
-
89
- UI.message("Latest build (Firebase App Distribution Android): #{fad_build_number_android}")
91
+ begin
92
+ unless firebase_app_android.nil?
93
+ response = Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction.run(
94
+ app: firebase_app_android,
95
+ service_credentials_file: firebase_json_key_path
96
+ )
97
+
98
+ unless response.nil?
99
+ fad_build_number_android = response[:buildVersion].to_i
100
+ end
101
+
102
+ UI.message("Latest build (Firebase App Distribution Android): #{fad_build_number_android}")
103
+ end
104
+ rescue StandardError => e
105
+ UI.error("Error getting latest build number (Firebase App Distribution Android): #{e.message}")
90
106
  end
91
107
 
92
108
  return [
@@ -100,17 +116,22 @@ module Fastlane
100
116
  # Returns the latest build number ("version code", in Android terminology)
101
117
  # for the given Google Play track.
102
118
  def self.get_google_play_build_number(track:, package_name:, json_key:)
103
- codes = Fastlane::Actions::GooglePlayTrackVersionCodesAction.run(
104
- track:,
105
- package_name:,
106
- json_key:
107
- )
119
+ begin
120
+ codes = Fastlane::Actions::GooglePlayTrackVersionCodesAction.run(
121
+ track:,
122
+ package_name:,
123
+ json_key:
124
+ )
108
125
 
109
- return codes.max
110
- rescue StandardError
111
- UI.message("No build numbers found for track #{track}")
112
- return 0
126
+ return codes.max
127
+ rescue StandardError
128
+ UI.message("No build numbers found for track #{track} (Google Play Store)")
129
+ return 0
130
+ end
113
131
  end
132
+
133
+ # TODO: Don't duplicate so much code
134
+ # def self.get_firebase_app_distribution_build_number()
114
135
  end
115
136
  end
116
137
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GetNewBuildNumber
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.5
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Pacia
@@ -173,6 +173,7 @@ files:
173
173
  - LICENSE
174
174
  - README.md
175
175
  - lib/fastlane/plugin/get_new_build_number.rb
176
+ - lib/fastlane/plugin/get_new_build_number/actions/get_new_build_name_action.rb
176
177
  - lib/fastlane/plugin/get_new_build_number/actions/get_new_build_number_action.rb
177
178
  - lib/fastlane/plugin/get_new_build_number/helper/get_new_build_number_helper.rb
178
179
  - lib/fastlane/plugin/get_new_build_number/version.rb