Class: Fastlane::Actions::HexsignProfilesDownloadByBundleIdAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



29
30
31
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 29

def self.authors
  ["HexSign"]
end

.available_optionsObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 50

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :bundle_id,
      env_name: "HEXSIGN_BUNDLE_ID",
      description: "App bundle identifier (exact match)",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :team_id,
      env_name: "HEXSIGN_TEAM_ID",
      description: "Apple Developer team identifier — scopes the download across linked accounts",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_dir,
      env_name: "HEXSIGN_PROFILE_OUTPUT_DIR",
      description: "Directory to write the .mobileprovision files into",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :install,
      env_name: "HEXSIGN_PROFILE_INSTALL",
      description: "macOS only: also install every downloaded profile into the directory Xcode reads",
      optional: true,
      type: Boolean,
      default_value: false
    )
  ]
end

.categoryObject



103
104
105
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 103

def self.category
  :code_signing
end

.descriptionObject



25
26
27
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 25

def self.description
  "Download every provisioning profile for a given bundle identifier via the HexSign CLI."
end

.detailsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 33

def self.details
  <<~DETAILS
    Wraps `hexsign profiles download --bundle-id <ID> [--team-id <TID>]`. Returns an
    array of absolute paths to the downloaded `.mobileprovision` files.

    Survives profile rotation: you point at a bundle identifier rather than the
    UUID of a specific provisioning profile.

    Pass `team_id` when the same bundle id exists in more than one linked Apple
    account to avoid pulling profiles from the wrong team.

    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.
  DETAILS
end

.example_codeObject



92
93
94
95
96
97
98
99
100
101
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 92

def self.example_code
  [
    'paths = hexsign_profiles_download_by_bundle_id(
      bundle_id: "com.example.app",
      team_id: "ABCDE12345",
      output_dir: "build/sign"
    )
    # => ["build/sign/foo.mobileprovision", "build/sign/bar.mobileprovision"]'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 88

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

.return_valueObject



84
85
86
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 84

def self.return_value
  "Array of absolute paths to the downloaded .mobileprovision files."
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/hexsign/actions/hexsign_profiles_download_by_bundle_id.rb', line 9

def self.run(params)
  args = ["profiles", "download", "--bundle-id", params[:bundle_id]]
  args.push("--team-id", params[:team_id]) if params[:team_id]
  args.push("--output-dir", params[:output_dir]) if params[:output_dir]
  args.push("--install") if params[:install]

  stdout = Helper::HexsignHelper.run(args)
  # With --install the CLI also prints "installed <name> -> <path>" lines;
  # keep only the downloaded-file paths.
  paths = stdout.split("\n").map(&:strip).reject(&:empty?)
                .reject { |line| line.start_with?("installed ") }

  UI.success("Downloaded #{paths.size} provisioning profile(s) for bundle #{params[:bundle_id]}")
  paths
end