Class: Fastlane::Actions::HexsignCertificatesDownloadByTypeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::HexsignCertificatesDownloadByTypeAction
- Defined in:
- lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
-
.parse_stdout(stdout) ⇒ Object
The CLI prints two lines per certificate: .p12 path then .password path.
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
39 40 41 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 39 def self. ["HexSign"] end |
.available_options ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 63 def self. [ FastlaneCore::ConfigItem.new( key: :type, env_name: "HEXSIGN_CERTIFICATE_TYPE", description: "Apple certificate type, e.g. IOS_DISTRIBUTION", optional: false, type: String ), FastlaneCore::ConfigItem.new( key: :team_id, env_name: "HEXSIGN_TEAM_ID", description: "Apple Developer team identifier to scope the download to", 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 ) ] end |
.category ⇒ Object
114 115 116 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 114 def self.category :code_signing end |
.description ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 35 def self.description "Download every signing certificate of a given type for one Apple Developer team via the HexSign CLI." end |
.details ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 43 def self.details <<~DETAILS Wraps `hexsign certificates download --type <T> --team-id <ID>`. Returns an array of { p12:, password: } hashes — one per downloaded certificate. Survives certificate rotation: you point at a cert type (e.g. IOS_DISTRIBUTION) rather than a specific UUID that changes when a cert is renewed. The hexsign binary must be on PATH — install via `brew install hexsign` or the hexsign/hexsign-cli GitHub Action. Set HEXSIGN_CLIENT_ID and HEXSIGN_CLIENT_SECRET so the CLI runs in machine mode. Accepted types: IOS_DEVELOPMENT, IOS_DISTRIBUTION, MAC_APP_DEVELOPMENT, MAC_APP_DISTRIBUTION, MAC_INSTALLER_DISTRIBUTION, DEVELOPER_ID_APPLICATION, DEVELOPER_ID_APPLICATION_G2, DEVELOPER_ID_KEXT, DEVELOPER_ID_KEXT_G2, DEVELOPER_ID_INSTALLER, DEVELOPMENT, DISTRIBUTION, PASS_TYPE_ID, PASS_TYPE_ID_WITH_NFC. DETAILS end |
.example_code ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 103 def self.example_code [ 'pairs = hexsign_certificates_download_by_type( type: "IOS_DISTRIBUTION", team_id: "ABCDE12345", output_dir: "build/sign" ) # => [{ p12: "build/sign/foo.p12", password: "build/sign/foo.password" }, ...]' ] end |
.is_supported?(platform) ⇒ Boolean
99 100 101 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 99 def self.is_supported?(platform) %i[ios mac tvos watchos visionos].include?(platform) end |
.output ⇒ Object
89 90 91 92 93 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 89 def self.output [ ["HEXSIGN_CERTIFICATES_DOWNLOAD_BY_TYPE_COUNT", "Number of certificates downloaded"] ] end |
.parse_stdout(stdout) ⇒ Object
The CLI prints two lines per certificate: .p12 path then .password path. Returns [{ p12: “…”, password: “…” }, …].
26 27 28 29 30 31 32 33 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 26 def self.parse_stdout(stdout) lines = stdout.split("\n").map(&:strip).reject(&:empty?) pairs = [] lines.each_slice(2) do |p12, password| pairs << { p12: p12, password: password } end pairs end |
.return_value ⇒ Object
95 96 97 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 95 def self.return_value "Array of { p12:, password: } hashes — one per downloaded certificate." end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_certificates_download_by_type.rb', line 9 def self.run(params) args = [ "certificates", "download", "--type", params[:type], "--team-id", params[:team_id] ] args.push("--output-dir", params[:output_dir]) if params[:output_dir] stdout = Helper::HexsignHelper.run(args) pairs = parse_stdout(stdout) UI.success("Downloaded #{pairs.size} #{params[:type]} certificate(s) for team #{params[:team_id]}") pairs end |