class Fastlane::Actions::DownloadCircleCiArtifactAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 78
def self.authors
  ["crazymanish"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 34
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "FL_DOWNLOAD_CIRCLE_CI_ARTIFACT_API_TOKEN",
                                 description: "API Token for CircleCI API",
                                 sensitive: true,
                                 code_gen_sensitive: true,
                                 is_string: true,
                                 default_value: ENV["CIRCLE_CI_API_TOKEN"],
                                 default_value_dynamic: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :file_url,
                                 env_name: "FL_DOWNLOAD_CIRCLE_CI_ARTIFACT_FILE_URL",
                                 description: "CircleCI artifact file url",
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :output_file_name,
                                 env_name: "FL_DOWNLOAD_CIRCLE_CI_ARTIFACT_OUTPUT_FILE_NAME",
                                 description: "CircleCI artifact output file name",
                                 is_string: true,
                                 optional: true)
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 30
def self.description
  "Download the CircleCI artifact file."
end
example_code() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 68
def self.example_code
  [
    'download_circle_ci_artifact(file_url: "circleci artifact file url")',
    'download_circle_ci_artifact(
      api_token: ENV["CIRCLE_CI_API_TOKEN"],
      file_url: "circleci artifact file url"
    )'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 82
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 58
def self.output
  [
    ['DOWNLOAD_CIRCLE_CI_ARTIFACT_RESULT', 'Output of the downloaded artifact']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 64
def self.return_value
  "Returns the output of the downloaded artifact."
end
run(params) click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/download_circle_ci_artifact.rb, line 11
def self.run(params)
  token = params[:api_token]
  url = params[:file_url]
  name = params[:output_file_name] || File.basename(url)

  curl_command = "curl -H 'Circle-Token: #{token}' -Ls -o /dev/null -w %{url_effective} #{url}"
  redirect_url = Actions::sh("#{curl_command}", log: false)

  curl_command = "curl -o #{name} '#{redirect_url}'"
  result = Actions::sh("#{curl_command}", log: false)

  Actions.lane_context[SharedValues::DOWNLOAD_CIRCLE_CI_ARTIFACT_RESULT] = result
  result
end