How can I copy AppStoreConnect private key to the correct folder?

I’m trying to upload my app to the Apple Store with a post build script. I was attempting to use the apikey access but I don’t know how to put the .p8 Authkey file in the correct directory.

This is the command I’m running
xcrun altool --upload-app -f ${UNITY_PLAYER_PATH} -t ios --apiIssuer $IOS_ISSUER_ID --apiKey $IOS_KEY_ID

This is the error I’m getting

NSLocalizedFailureReason=The file ‘AuthKey_{ID}.p8’ could not be found in any of these locations: ‘~/private_keys’, ‘~/.private_keys’, ‘~/.appstoreconnect/private_keys’.},

Do I need to run a command to copy the file manually? Would it be in this script or in a pre build script? Or is there some other way to put this file in the right location?

I don’t have access to xcode so I’m hoping to use Cloud Build to Upload. If this doesn’t work I don’t have a reason to continue using Cloud Build as I’ll be forced to use another resource or buy a macbook. I’m not paying for every build I run just to figure this out, I’d rather pay for a macbook.

You shouldn’t need to set the apiIssuer or apiKey. I’ve always managed to upload successfully using just the username/password.

Here’s the best and most up to date bash script to use:
Path to the final IPA file page-2#post-7608046

And here are some instructions on how to use it:

1 Like