Class: Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction
Constant Summary
Fastlane::Auth::FirebaseAppDistributionAuthClient::CLIENT_ID, Fastlane::Auth::FirebaseAppDistributionAuthClient::CLIENT_SECRET, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_CHARACTER, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_EXPOSED_LENGTH, Fastlane::Auth::FirebaseAppDistributionAuthClient::SCOPE, Fastlane::Auth::FirebaseAppDistributionAuthClient::TOKEN_CREDENTIAL_URI
Class Method Summary
collapse
get_authorization
app_name_from_app_id, binary_type_from_path, blank?, deep_symbolize_keys, get_ios_app_id_from_archive_plist, get_value_from_value_or_file, group_name, init_google_api_client, parse_plist, present?, project_name, project_number_from_app_id, string_to_array
Class Method Details
.authors ⇒ Object
120
121
122
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 120
def self.authors
["[email protected]"]
end
|
.available_options ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 79
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :app,
env_name: "FIREBASEAPPDISTRO_APP",
description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
optional: false,
type: String),
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
description: "Auth token generated using Firebase CLI's login:ci command",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :service_credentials_file,
description: "Path to Google service account json",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
description: "Google service account json file content",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :debug,
description: "Print verbose debug output",
optional: true,
default_value: false,
is_string: false)
]
end
|
.description ⇒ Object
69
70
71
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 69
def self.description
"Fetches the latest release in Firebase App Distribution"
end
|
.details ⇒ Object
73
74
75
76
77
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 73
def self.details
[
"Fetches information about the most recently created release in App Distribution, including the version and release notes. Returns nil if no releases are found."
].join("\n")
end
|
.example_code ⇒ Object
128
129
130
131
132
133
134
135
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 128
def self.example_code
[
'release = firebase_app_distribution_get_latest_release(app: "<your Firebase app ID>")',
'increment_build_number({
build_number: firebase_app_distribution_get_latest_release(app: "<your Firebase app ID>")[:buildVersion].to_i + 1
})'
]
end
|
.is_supported?(platform) ⇒ Boolean
124
125
126
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 124
def self.is_supported?(platform)
true
end
|
.map_release_hash(release) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 46
def self.map_release_hash(release)
{
name: release.name,
releaseNotes: map_release_notes_hash(release.release_notes),
displayVersion: release.display_version,
buildVersion: release.build_version,
binaryDownloadUri: release.binary_download_uri,
firebaseConsoleUri: release.firebase_console_uri,
testingUri: release.testing_uri,
createTime: release.create_time
}
end
|
.map_release_notes_hash(release_notes) ⇒ Object
59
60
61
62
63
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 59
def self.map_release_notes_hash(release_notes)
return nil if release_notes.nil?
{ text: release_notes.text }
end
|
.output ⇒ Object
106
107
108
109
110
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 106
def self.output
[
['FIREBASE_APP_DISTRO_LATEST_RELEASE', 'A hash representing the lastest release created in Firebase App Distribution']
]
end
|
.return_type ⇒ Object
116
117
118
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 116
def self.return_type
:hash
end
|
.return_value ⇒ Object
112
113
114
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 112
def self.return_value
"Hash representation of the lastest release created in Firebase App Distribution (see https://firebase.google.com/docs/reference/app-distribution/rest/v1/projects.apps.releases#resource:-release)"
end
|
.run(params) ⇒ Object
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
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 15
def self.run(params)
init_google_api_client(params[:debug])
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
UI.message("⏳ Fetching latest release for app #{params[:app]}...")
parent = app_name_from_app_id(params[:app])
begin
releases = client.list_project_app_releases(parent, page_size: 1).releases
rescue Google::Apis::Error => err
if err.status_code.to_i == 404
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{params[:app]}")
else
UI.crash!(err)
end
end
if releases.nil? || releases.empty?
latest_release = nil
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].")
else
latest_release = map_release_hash(releases[0])
UI.success("✅ Latest release fetched successfully. Returning release and setting Actions.lane_context[SharedValues::FIREBASE_APP_DISTRO_LATEST_RELEASE].")
end
Actions.lane_context[SharedValues::FIREBASE_APP_DISTRO_LATEST_RELEASE] = latest_release
return latest_release
end
|
.sample_return_value ⇒ Object
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 137
def self.sample_return_value
{
name: "projects/123456789/apps/1:1234567890:ios:0a1b2c3d4e5f67890/releases/0a1b2c3d4",
releaseNotes: {
text: "Here are some release notes!"
},
displayVersion: "1.2.3",
buildVersion: "10",
binaryDownloadUri: "<URI>",
firebaseConsoleUri: "<URI>",
testingUri: "<URI>",
createTime: "2021-10-06T15:01:23Z"
}
end
|