"package" for macOS not working: Hardened Runtime is Not Enabled

I am trying to package my project using the unrealEditor.
When I package the project, it is successful, and if I ‘show package contents’ on the .xcarchive file and drill down to the application, it launches.
However, if I go into the “Archive” section of Xcode to notarize and create a distribution version of the application, it disallows this saying the “Hardened Runtime is Not Enabled.”

This setting is enabled in the Xcode project, and if I compile directly with Xcode the application can be notarized. (There are other issues with compiling with Xcode however.)

Is there a way to enable hardened runtime for packaging from within unreal editor?

Same here…

What needs to be done is get UnrealAutomationTool to pass the argument ‘—options runtime’ to the /usr/bin/codesign binary. But this is just not possible unless you are working with UE source rather than from the Epic Launcher.

A workaround is to run code sign again manually inside your .xcarchive

navigate a command prompt to your packaged .xcarchive and inside it is Products/Applications

run the command
codesign --deep --force --options runtime --verify --verbose --sign “FAF98FHA3J” YourAppName.app

(Not my real developer ID up there)

From there you can just use the automatic distribution option in Xcode->Windows->Organiser