Class: Fastlane::Actions::HexsignCertificatesDownloadAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb

Class Method Summary collapse

Class Method Details

.authorsObject



22
23
24
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 22

def self.authors
  ["HexSign"]
end

.available_optionsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 36

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :id,
      env_name: "HEXSIGN_CERTIFICATE_ID",
      description: "Certificate ID to download",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_dir,
      env_name: "HEXSIGN_CERTIFICATE_OUTPUT_DIR",
      description: "Directory to write the .p12 and .password files into",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :filename,
      env_name: "HEXSIGN_CERTIFICATE_FILENAME",
      description: "Base filename (no extension) for the downloaded files",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :keychain,
      env_name: "HEXSIGN_KEYCHAIN",
      description: "macOS only: create this keychain and import the downloaded .p12 into it, ready for codesigning",
      optional: true,
      type: String
    )
  ]
end

.categoryObject



80
81
82
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 80

def self.category
  :code_signing
end

.descriptionObject



18
19
20
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 18

def self.description
  "Download an Apple signing certificate (.p12 + .password) via the HexSign CLI."
end

.detailsObject



26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 26

def self.details
  <<~DETAILS
    Wraps `hexsign certificates download <id>`. The hexsign binary must be on PATH —
    install it with `brew install hexsign` or via the hexsign/hexsign-cli GitHub Action.

    Set HEXSIGN_CLIENT_ID and HEXSIGN_CLIENT_SECRET in the environment so the CLI runs
    in machine mode. See https://github.com/hexsign/hexsign-cli for token provisioning.
  DETAILS
end

.example_codeObject



73
74
75
76
77
78
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 73

def self.example_code
  [
    'hexsign_certificates_download(id: "cert-abc123", output_dir: "build/sign")',
    'hexsign_certificates_download(id: "cert-abc123", keychain: "/tmp/hexsign-ci.keychain-db")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 69

def self.is_supported?(platform)
  %i[ios mac tvos watchos visionos].include?(platform)
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download.rb', line 9

def self.run(params)
  args = ["certificates", "download", params[:id]]
  args.push("--output-dir", params[:output_dir]) if params[:output_dir]
  args.push("--filename", params[:filename]) if params[:filename]
  args.push("--keychain", params[:keychain]) if params[:keychain]

  Helper::HexsignHelper.run(args).tap { UI.success("Downloaded certificate #{params[:id]}") }
end