Sha256: ce5fd7153a4d0532708a4b730d0757621dd7362303be0d48747c7a001d45932e

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module Fastlane
  module Actions
    # Resigns the ipa
    class ResignAction < Action
      def self.run(params)
        require 'sigh'

        params = params.first

        raise 'You must pass valid params to the resign action. Please check the README.md'.red if (params.nil? || params.empty?)

        ipa                   = params[:ipa] || Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
        signing_identity      = params[:signing_identity]
        provisioning_profile  = params[:provisioning_profile] || Actions.lane_context[SharedValues::SIGH_PROFILE_PATH]

        raise 'Please pass a valid ipa which should be a path to an ipa on disk'.red unless ipa
        raise 'Please pass a valid signing_identity'.red unless signing_identity
        raise 'Please pass a valid provisioning_profile which should be a path to a profile on disk.'.red unless provisioning_profile

        # try to resign the ipa
        if Sigh::Resign.resign(ipa, signing_identity, provisioning_profile)
          Helper.log.info 'Successfully re-signed .ipa 🔏.'.green
        else
          raise 'Failed to re-sign .ipa'.red
        end
      end

      def self.description
        "Code sign an existing API"
      end

      def self.available_options
        [
          ['ipa', 'Path to the ipa file to resign. Optional if you use the `ipa` or `xcodebuild` action'],
          ['signing_identity', 'Code signing identity to use. e.g. "iPhone Distribution: Luka Mirosevic (0123456789)"'],
          ['provisioning_profile', 'Path to your provisioning_profile. Optional if you use `sigh`']
        ]
      end

      def self.author
        "lmirosevic"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastlane-0.7.0 lib/fastlane/actions/resign.rb