how to build pkg file with xcode cloud that is notarized and also has postinstall file?

I am creating a macOS app with the following requirements:

Automatic Startup: After initial installation, the app should automatically start, even after the OS restarts.

Notarized Installation: The installation package (.pkg) should be notarized to avoid user have to make security exception.

In my current setup I’ve created a script, ci_scripts/ci_post_xcodebuild.sh, which uploads the package file $CI_APP_STORE_SIGNED_APP_PATH/<appName>.pkg to GitHub via Xcode Cloud. While I can successfully download the app, I’m encountering two main issues:

Notarization (I assume): I’m unsure how to get Xcode Cloud to notarize the .pkg file. Currently, upon opening the .pkg file for the first time, users have to go to System Settings > Privacy & Security to allow an exception for the package, after which installation proceeds successfully on second try. I’d like to automate the notarization process to eliminate this extra step.

Adding Additional Files to PKG installer: My current .pkg file only includes the app binary. I need to configure Xcode Cloud to include a postinstall script and a launchd daemon configuration file within the package. This would ensure that necessary files are set up on installation and that the app is properly registered as a launch daemon.

how to build pkg file with xcode cloud that is notarized and also has postinstall file?
 
 
Q