Command CodeSign failed with a nonzero exit code
warning: unable to build chain to self-signed root for signer "Apple Distribution: name. (teamID)"
/Users/name/Library/Developer/Xcode/DerivedData/app-fjkfkfdf/Build/Intermediates.noindex/ArchiveIntermediates/helloworld/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist.appex: errSecInternalComponent'
Showing Recent Errors Only Command CodeSign failed with a nonzero exit code
you can find a solution for your problem here https://stackoverflow.com/a/66083449/1053997
I had the same issue and this worked for me. This is probably because your keychain is missing a "Worldwide Developer Relations Certificate Authority" certificate