Class: Fastlane::Actions::FirebaseAppDistributionGetLatestReleaseAction

Inherits:
Action
  • Object
show all
Extended by:
Fastlane::Auth::FirebaseAppDistributionAuthClient, Helper::FirebaseAppDistributionHelper
Defined in:
lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb

Constant Summary

Constants included from Fastlane::Auth::FirebaseAppDistributionAuthClient

Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_CHARACTER, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_EXPOSED_LENGTH, Fastlane::Auth::FirebaseAppDistributionAuthClient::TOKEN_CREDENTIAL_URI

Documentation collapse

Class Method Summary collapse

Methods included from Fastlane::Auth::FirebaseAppDistributionAuthClient

fetch_auth_token

Methods included from Helper::FirebaseAppDistributionHelper

app_name_from_app_id, binary_type_from_path, blank?, get_ios_app_id_from_archive_plist, get_value_from_value_or_file, parse_plist, present?, string_to_array

Class Method Details

.authorsObject



81
82
83
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 81

def self.authors
  ["[email protected]"]
end

.available_optionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 44

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 'fastlane run firebase_app_distribution_login', or the 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: :debug,
                                 description: "Print verbose debug output",
                                 optional: true,
                                 default_value: false,
                                 is_string: false)
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 34

def self.description
  "Fetches the latest release in Firebase App Distribution"
end

.detailsObject



38
39
40
41
42
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 38

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_codeObject



89
90
91
92
93
94
95
96
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 89

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

Returns:

  • (Boolean)


85
86
87
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 85

def self.is_supported?(platform)
  true
end

.outputObject



67
68
69
70
71
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 67

def self.output
  [
    ['FIREBASE_APP_DISTRO_LATEST_RELEASE', 'A hash representing the lastest release created in Firebase App Distribution']
  ]
end

.return_typeObject



77
78
79
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 77

def self.return_type
  :hash
end

.return_valueObject



73
74
75
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 73

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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 12

def self.run(params)
  auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
  fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, params[:debug])

  UI.message("⏳ Fetching latest release for app #{params[:app]}...")

  releases = fad_api_client.list_releases(app_name_from_app_id(params[:app]), 1)[:releases] || []
  if releases.empty?
    latest_release = nil
    UI.important("No releases for app #{params[:app]} found in App Distribution. Returning nil and setting Actions.lane_context[:FIREBASE_APP_DISTRO_LATEST_RELEASE].")
  else
    latest_release = releases[0]
    UI.success("✅ Latest release fetched successfully. Returning release and setting Actions.lane_context[:FIREBASE_APP_DISTRO_LATEST_RELEASE].")
  end
  Actions.lane_context[:FIREBASE_APP_DISTRO_LATEST_RELEASE] = latest_release
  return latest_release
end

.sample_return_valueObject



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb', line 98

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",
    createTime: "2021-10-06T15:01:23Z"
  }
end