Xcode post-signing action

I'm using Xcode 10 on MacOS Mojave to create a MacOS app. This app will be distributed outside of Mac App Store, so I let Xcode auto-sign it with Developer ID. My question is how to move the target .app to a specific folder after code signing. The post-build action doesn't work since it seems to happen before code signing. I don't want to do code signing on command line by myself, because I want Xcode to add hardened runtime and com.apple.security.get-task-allow entitlements for me. Thanks!

Replies

I have the same question. I have all the code for zipping and notarizing, but it fails because the post build script runs before the signing, even if I drag the order to the end in the Build Phases.

Edit: found a solution here:
https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc

You need to do your post build script on archive. This allows it to sign before running your script to notarize.