def create_profile!
      cert = certificate_to_use
      bundle_id = Sigh.config[:app_identifier]
      name = Sigh.config[:provisioning_name] || [bundle_id, profile_type.pretty_type].join(' ')

      unless Sigh.config[:skip_fetch_profiles]
        if Spaceship.provisioning_profile.all.find { |p| p.name == name }
          UI.error("The name '#{name}' is already taken, using another one.")
          name += " #{Time.now.to_i}"
        end
      end

      UI.important("Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}' for '#{Sigh.config[:platform]}' platform")
      profile = profile_type.create!(name: name,
                                bundle_id: bundle_id,
                              certificate: cert,
                                      mac: Sigh.config[:platform].to_s == 'macos',
                             sub_platform: Sigh.config[:platform].to_s == 'tvos' ? 'tvOS' : nil,
                            template_name: Sigh.config[:template_name])
      profile
    end
def create_profile!
      cert = certificate_to_use
      bundle_id = Sigh.config[:app_identifier]
      name = Sigh.config[:provisioning_name] || [bundle_id, profile_type.pretty_type].join(' ')

      unless Sigh.config[:skip_fetch_profiles]
        if Spaceship.provisioning_profile.all.find { |p| p.name == name }
          UI.error("The name '#{name}' is already taken, using another one.")
          name += " #{Time.now.to_i}"
        end
      end

      UI.important("Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}' for '#{Sigh.config[:platform]}' platform")
      profile = profile_type.create!(name: name,
                                bundle_id: bundle_id,
                              certificate: cert,
                                      mac: Sigh.config[:platform].to_s == 'macos',
                             sub_platform: Sigh.config[:platform].to_s == 'tvos' ? 'tvOS' : nil,
                            template_name: Sigh.config[:template_name])
      profile
    end
Create a new profile and return it