Skip to content

Instantly share code, notes, and snippets.

@danielbowden
Last active December 12, 2016 06:13
Show Gist options
  • Save danielbowden/7cb4a5c71a0372ea3b7ceeae1c71022a to your computer and use it in GitHub Desktop.
Save danielbowden/7cb4a5c71a0372ea3b7ceeae1c71022a to your computer and use it in GitHub Desktop.
Custom Fastlane action - Returns the provisioning profile specifier for the provided provisioning profile
module Fastlane
module Actions
module SharedValues
GET_PROVISIONING_PROFILE_SPECIFIER_CUSTOM_VALUE = :GET_PROVISIONING_PROFILE_SPECIFIER_CUSTOM_VALUE
end
class GetProvisioningProfileSpecifierAction < Action
def self.run(params)
profile_path = params[:profile]
UI.message "Provisioning profile: #{profile_path}"
parsed = FastlaneCore::ProvisioningProfile.parse(profile_path)
parsed["Name"]
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Returns the provisioning profile specifier for the provided provisioning profile"
end
def self.details
"Returns the provisioning profile specifier for the provided provisioning profile"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :profile,
env_name: "FL_GET_PROVISIONING_PROFILE_SPECIFIER_PROFILE_PATH",
description: "The path to a provisioning profile",
optional: false,
verify_block: proc do |value|
UI.user_error!("Couldn't find provisioning profile at path `#{value}`") unless File.exist?(value)
end
)
]
end
def self.output
[
['GET_PROVISIONING_PROFILE_SPECIFIER', 'The corresponding provisioning profile specifier']
]
end
def self.return_value
"The returned provisioning profile specifier is to be used in an environment variable for Xcode 8+ to use in order to select the correct provisioning profile"
end
def self.authors
["danielbowden"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment