Mohamed Obaya
Mohamed Obaya

Reputation: 2583

Fastlane How to automate the deletion of provisioning profile?

I'm in a situation where I need to automate the deletion of appstore provision profiles. I tried to fastlane match nuke distribution but it revoked certificated to and I just want to remove provisioning profile.

Upvotes: 1

Views: 1319

Answers (1)

Mohamed Obaya
Mohamed Obaya

Reputation: 2583

this script can do it you need to pass TeamID and bundellID

lane :delete_profiles do |options|
    require "spaceship" 
    ENV['FASTLANE_TEAM_ID'] = options[:team_id]
    Spaceship::Portal.select_team
    matching_profiles = Spaceship::Portal.provisioning_profile.app_store.find_by_bundle_id(bundle_id: options[:bundle_id])
    Spaceship::Portal.client.delete_provisioning_profile!(matching_profiles.first.id)
  end

fastlane delete_profiles bundle_id:'YourBundelID' team_id:'YourTeamId'

As my Apple ID is added to multiple teams so I just select the team first. Then get the provisioning profile by ID then delete it.

Upvotes: 4

Related Questions