macOS: How to target the Mac App Store or notarize an app for distribution

Notarizing an app that uses Chromium

For reference, please see this zip folder, which contains an example notarize-app.sh bash script and entitlements.plist file that can be used to successfully notarize apps that use 3D WebView's default Chromium browser engine backend. Before running this script, you must first update the values of the variables in all caps (e.g. APPLE_ID, TEAM_ID, PASSWORD, etc) to match the details for your developer account and app. After you have populated the script's variables with the correct information, you can execute it via the macOS Terminal app. If the app is notarized successfully, the script's terminal output should resemble the following:

Code signing...
./build-mac.app: replacing existing signature
./build-mac.app: signed app bundle with Mach-O universal (x86_64 arm64) [...]
Creating archive...
...
Uploading to the notarization service...
...
Successfully uploaded file
  id: {submission_id}
  path: /Users/example/archive.zip
Waiting for processing to complete.
Current status: Accepted...............
Processing complete
  id: {submission_id}
  status: Accepted
Removing archive...
Finished notarization. Next, stapling the ticket to the app...
Processing: /Users/example/build-mac.app
The staple and validate action worked!
Verifying that the app has been properly notarized...
./build-mac.app: valid on disk
./build-mac.app: satisfies its Designated Requirement
./build-mac.app: explicit requirement satisfied
Processing: /Users/example/build-mac.app
The validate action worked!
Finished verification.

If notarization instead failed, you can determine why it failed by using xcrun notarytool log command to download the notarization logs.