Adding apple certificate: "*** Error: Failed to store the password in the keychain."

I am trying to set up a CD pipeline to build my macOS app. I am failing to add a certificate to the keychain with "security import ...", getting the error:

PKS Importing signing certificate: build/osx/Release/FD_certificate.p12, build.keychain
1 identity imported.
2023-10-18 23:53:02.056 *** Error: Failed to store the password in the keychain.
2023-10-18 23:53:02.058 *** Error: Failed to store the password in the keychain. You must specify a name for the keychain item. (-1021)
 {
    NSLocalizedDescription = "Failed to store the password in the keychain.";
    NSLocalizedFailureReason = "You must specify a name for the keychain item.";
}
The line in question is build routine is here: https://github.com/patrickkidd/familydiagram/blob/main-cd/bin/setup_provisioning_profile.sh

I have googled for this and tried GPT a number of different ways and there doesn't seem to be any way to add a name for the certificate "item" in the keychain.

Thanks!

Replies

Updated link to setup code with frozen revision (since I'm still experimenting on the main branch): https://github.com/patrickkidd/familydiagram/blob/958f65ea6895215015adb06d4c9e84ab987c8f15/bin/setup_provisioning_profile.sh