After quite a lot of trial-and-error I've worked it out. This is the extra key needed in the TemplateInfo.plist. This adds a script that will run after the other default build phases.
TargetsBuildPhasesClassShellScriptShellPath/bin/shShellScript# Just a comment