Generation iof IPA CLI

Hello, guys! I am stuck in generating IPA using the command-line interface (CLI). I have a scenario where I'm learning to automate the IPA generation by passing the necessary values through the CLI.

I have created a separate keychain for this purpose. However, I am facing a situation where even if I pass a specific keychain value in the CLI, it still appears to be looking in the default keychain.

I already have the iOS distribution certificate and Apple distribution certificate installed in the Login keychain. I won't delete them because I need them for generating IPA files from Xcode. I want to avoid adding them again and repeating the same steps.

iPhone Distribution: “Team_Name” (Team_ID) Apple Distribution: Team_Name” (Team_ID)

When I have the above two certificates installed in the login keychain, and I try to build using the 'iPhone Distribution' option, I receive an error stating that the provisioning profile 'Adhov' doesn't include the signing certificate 'Apple Distribution:'. I don't understand why it is pointing to the distribution certificate.

My main issue is that even though I have specified to pick the certificates from the custom keychain, when both certificates are installed in the login keychain. I am able to import the certificate into the custom keychain. When I try to codesign using these below commands , it throws an error stating that it doesn't include the signing certificate for the Apple distribution certificate in my iOS distribution profile.

Here are the code snippets I am trying to work on.

#Unlock the custom keychain security unlock-keychain -p “Password” ~/Library/Keychains/customKeychain.keychain

#importing the p12 certificate to custom keychain security import "${16}"."p12" -P ${17} -A -k ~/Library/Keychains/customKeychain.keychain

#allow all applications to access this item security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k “password” ~/Library/Keychains/customKeychain.keychain #Check for valid identity security find-identity -v -p codesigning ~/Library/Keychains/customKeychain.keychain

#generating the archive file xcodebuild -workspace "$1" -scheme "$2" -configuration Release -archivePath $6/$9."xcarchive" archive

#codesigning for the archive file codesign -s ${18} $6/$9."xcarchive"

#exporting IPA file xcodebuild -exportArchive -archivePath ${6}/${9}."xcarchive" -exportPath ${6}/${9} -exportOptionsPlist ${8}

#delete the certificate after successfull build generation security delete-certificate -c ${18} ~/Library/Keychains/dws.keychain

Generation iof IPA CLI
 
 
Q