Earlier quoted context omitted.
I don't think you can. All virtualized MacOS machines, iirc, can't fully install the tools necessary to build software for MacOS. For example, I don't believe you will ever be able to sign and staple the app. I would really love to have someone prove me wrong on this thread but I've never found a solution other than building on MacOS hardware, which is such a pain to maintain. I have multiple old MacOS machines that…
You can run codesign just fine in a VM.
But, this is the issue I believe:
https://mjtsai.com/blog/2023/09/15/limitations-on-macos-virt...
(or, the original is here: https://eclecticlight.co/2023/12/26/when-macos-wont-work-wit...)
You cannot login using AppleID. If you can't do that, aren't you prevented from basically doing any kind of stapling and/or retrieving certificates for signing?
I would LOVE to be wrong about this. You've done that?