Go Templates, for the curious:
If you want people to be interested or care, you have to imagine that you are them - they don’t know all the things you know.
(This is not about your project. I just wanted to get that off my chest. ;)
For Kubernetes' own resources it might be easy to code. For CRDs, that's a whole other world.
One solution: annotate both the deployment and the secret, then use the name template to export them into the same file or, in other words, split based on annotations. Hope that helps!