fastlane-plugin-firebase_app_distribution 0.10.0 → 0.10.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b85c6c60b76c751c0f4f5ca2611bd6735b5540b1525e600dad266b354bcc2e7
4
- data.tar.gz: dbee1fc079ed0d7c8f1b50aec4cc22339e7046cf97b100576564797afa440e48
3
+ metadata.gz: 789a32fce54326215942dfb99d0bb843887a36d84ca3ecfc474d4408b02c103d
4
+ data.tar.gz: f2d3b26d638efddc8920e9df5b01bbb4efa176e26d91a33cb8ab781b2996ac11
5
5
  SHA512:
6
- metadata.gz: 5fd6c96184db82f9d38dc5495b2c8adcd9b42326f45420afcf50b9db66064dd7c07228d694d349b0c1ee3e82782cc8fe76ec5e0889841574f3c12ecaeff89362
7
- data.tar.gz: 3f5e0aafc6c0b09ae3722f7fd65522009470c70cad2bd115fd061f2c38a63522eec6b77aa036df9e21cc30b6704134fe593ec132dee5026e65a50d29366f4d91
6
+ metadata.gz: 72c6db99756504fc29a2e5ef24baf600a5bb13ddb3758385b240876fc5d3cf891c5c9bdc7037400aa3272d5aefe1fd2cdb2f2ea677b0dfa12f9fab78636012d3
7
+ data.tar.gz: d8a9c0d7ffc1d44813d8f97944d3db5dc3d3bf0eedfb4af3f89d4353d4bb3483a7ce4e7ae39bd502f1a302cc2ac94572ddee07842974644bbff0e9d02cf25cec
@@ -142,34 +142,6 @@ module Fastlane
142
142
  test_password && test_password.sub(/\r?\n$/, "")
143
143
  end
144
144
 
145
- def self.app_id_from_params(params)
146
- if params[:app]
147
- app_id = params[:app]
148
- elsif xcode_archive_path
149
- plist_path = params[:googleservice_info_plist_path]
150
- app_id = get_ios_app_id_from_archive_plist(xcode_archive_path, plist_path)
151
- end
152
- if app_id.nil?
153
- UI.crash!(ErrorMessage::MISSING_APP_ID)
154
- end
155
- app_id
156
- end
157
-
158
- def self.xcode_archive_path
159
- # prevents issues on cross-platform build environments where an XCode build happens within
160
- # the same lane
161
- return nil if lane_platform == :android
162
-
163
- # rubocop:disable Require/MissingRequireStatement
164
- Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE]
165
- # rubocop:enable Require/MissingRequireStatement
166
- end
167
-
168
- def self.lane_platform
169
- # to_sym shouldn't be necessary, but possibly fixes #376
170
- Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]&.to_sym
171
- end
172
-
173
145
  def self.platform_from_app_id(app_id)
174
146
  if app_id.include?(':ios:')
175
147
  :ios
@@ -492,7 +464,7 @@ module Fastlane
492
464
  optional: true),
493
465
  FastlaneCore::ConfigItem.new(key: :googleservice_info_plist_path,
494
466
  env_name: "GOOGLESERVICE_INFO_PLIST_PATH",
495
- description: "Path to your GoogleService-Info.plist file, relative to the archived product path",
467
+ description: "Path to your GoogleService-Info.plist file, relative to the archived product path (or directly, if no archived product path is found)",
496
468
  default_value: "GoogleService-Info.plist",
497
469
  optional: true,
498
470
  type: String),
@@ -19,15 +19,15 @@ module Fastlane
19
19
  client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
20
20
  client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
21
21
 
22
- UI.message("⏳ Fetching latest release for app #{params[:app]}...")
23
-
24
- parent = app_name_from_app_id(params[:app])
22
+ app_id = app_id_from_params(params)
23
+ UI.message("⏳ Fetching latest release for app #{app_id}...")
24
+ parent = app_name_from_app_id(app_id)
25
25
 
26
26
  begin
27
27
  releases = client.list_project_app_releases(parent, page_size: 1).releases
28
28
  rescue Google::Apis::Error => err
29
29
  if err.status_code.to_i == 404
30
- UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{params[:app]}")
30
+ UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
31
31
  else
32
32
  UI.crash!(err)
33
33
  end
@@ -35,7 +35,7 @@ module Fastlane
35
35
 
36
36
  if releases.nil? || releases.empty?
37
37
  latest_release = nil
38
- UI.important("No releases for app #{params[:app]} found in App Distribution. Returning nil and setting Actions.lane_context[SharedValues::FIREBASE_APP_DISTRO_LATEST_RELEASE].")
38
+ UI.important("No releases for app #{app_id} found in App Distribution. Returning nil and setting Actions.lane_context[SharedValues::FIREBASE_APP_DISTRO_LATEST_RELEASE].")
39
39
  else
40
40
  # latest_release = append_json_style_fields(response.releases[0].to_h)
41
41
  latest_release = map_release_hash(releases[0])
@@ -80,10 +80,19 @@ module Fastlane
80
80
 
81
81
  def self.available_options
82
82
  [
83
+ # iOS Specific
84
+ FastlaneCore::ConfigItem.new(key: :googleservice_info_plist_path,
85
+ env_name: "GOOGLESERVICE_INFO_PLIST_PATH",
86
+ description: "Path to your GoogleService-Info.plist file, relative to the archived product path (or directly, if no archived product path is found)",
87
+ default_value: "GoogleService-Info.plist",
88
+ optional: true,
89
+ type: String),
90
+
91
+ # General
83
92
  FastlaneCore::ConfigItem.new(key: :app,
84
93
  env_name: "FIREBASEAPPDISTRO_APP",
85
94
  description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
86
- optional: false,
95
+ optional: true,
87
96
  type: String),
88
97
  FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
89
98
  description: "Auth token generated using Firebase CLI's login:ci command",
@@ -1,3 +1,4 @@
1
+ require 'fastlane/action'
1
2
  require 'fastlane_core/ui/ui'
2
3
  require 'cfpropertylist'
3
4
  require 'google/apis/core'
@@ -36,15 +37,52 @@ module Fastlane
36
37
  string.strip.split(delimiter).map(&:strip)
37
38
  end
38
39
 
40
+ def app_id_from_params(params)
41
+ plist_path = params[:googleservice_info_plist_path]
42
+ if params[:app]
43
+ UI.message("Using app ID from 'app' parameter")
44
+ app_id = params[:app]
45
+ elsif xcode_archive_path
46
+ UI.message("Using app ID from the GoogleService-Info.plist file located using the 'googleservice_info_plist_path' parameter, relative to the archive path: #{xcode_archive_path}")
47
+ app_id = get_ios_app_id_from_archive_plist(xcode_archive_path, plist_path)
48
+ elsif plist_path
49
+ UI.message("Using app ID from the GoogleService-Info.plist file located using the 'googleservice_info_plist_path' parameter directly since no archive path was found")
50
+ app_id = get_ios_app_id_from_plist(plist_path)
51
+ end
52
+ if app_id.nil?
53
+ UI.crash!(ErrorMessage::MISSING_APP_ID)
54
+ end
55
+ app_id
56
+ end
57
+
58
+ def lane_platform
59
+ # to_sym shouldn't be necessary, but possibly fixes #376
60
+ Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]&.to_sym
61
+ end
62
+
63
+ def xcode_archive_path
64
+ # prevents issues on cross-platform build environments where an XCode build happens within
65
+ # the same lane
66
+ return nil if lane_platform == :android
67
+
68
+ # rubocop:disable Require/MissingRequireStatement
69
+ Actions.lane_context[Actions::SharedValues::XCODEBUILD_ARCHIVE]
70
+ # rubocop:enable Require/MissingRequireStatement
71
+ end
72
+
39
73
  def parse_plist(path)
40
74
  CFPropertyList.native_types(CFPropertyList::List.new(file: path).value)
41
75
  end
42
76
 
43
- def get_ios_app_id_from_archive_plist(archive_path, plist_path)
77
+ def get_ios_app_id_from_archive_plist(archive_path, relative_plist_path)
44
78
  app_path = parse_plist("#{archive_path}/Info.plist")["ApplicationProperties"]["ApplicationPath"]
45
79
  UI.shell_error!("can't extract application path from Info.plist at #{archive_path}") if app_path.empty?
46
- identifier = parse_plist("#{archive_path}/Products/#{app_path}/#{plist_path}")["GOOGLE_APP_ID"]
47
- UI.shell_error!("can't extract GOOGLE_APP_ID") if identifier.empty?
80
+ return get_ios_app_id_from_plist("#{archive_path}/Products/#{app_path}/#{relative_plist_path}")
81
+ end
82
+
83
+ def get_ios_app_id_from_plist(plist_path)
84
+ identifier = parse_plist(plist_path)["GOOGLE_APP_ID"]
85
+ UI.shell_error!("can't extract GOOGLE_APP_ID from #{plist_path}") if identifier.empty?
48
86
  return identifier
49
87
  end
50
88
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FirebaseAppDistribution
3
- VERSION = "0.10.0"
3
+ VERSION = "0.10.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-firebase_app_distribution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -9,7 +9,7 @@ authors:
9
9
  - Alonso Salas Infante
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-01-07 00:00:00.000000000 Z
12
+ date: 2025-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-apis-firebaseappdistribution_v1