Skip to content

Instantly share code, notes, and snippets.

@Draknek
Created August 6, 2026 19:30
Show Gist options
  • Select an option

  • Save Draknek/31f983c3f9b8ee084e8f6a4107b36b15 to your computer and use it in GitHub Desktop.

Select an option

Save Draknek/31f983c3f9b8ee084e8f6a4107b36b15 to your computer and use it in GitHub Desktop.
#!/bin/bash
this_dir="$( dirname "${BASH_SOURCE[0]}" )"
if [ -f "$this_dir/config.sh" ]
then
. "$this_dir/config.sh"
fi
for i in RCODESIGN NOTARIZE_P12_PASSWORD
do
if [ -z "${!i}" ]
then
echo "Config not set up: no $i variable defined"
exit 1
fi
done
p12_file="$this_dir/notarize.p12"
json_file="$this_dir/notarize.json"
# trim trailing slashes from target file
TARGET=$(echo "$1" | sed 's:/*$::')
if [ $# -ne 1 ]
then
echo "Usage: $0 path/to/game.app"
exit
fi
if [ -f "$TARGET" ]
then
echo "$1 needs to be a .app folder"
exit 1
fi
if ! [ -d "$TARGET" ]
then
echo "$1 does not exist"
exit 1
fi
if [ "${TARGET: -4}" != ".app" ]
then
echo "$1 needs to be a .app folder"
exit 1
fi
"$RCODESIGN" sign --p12-file "$p12_file" --p12-password "$NOTARIZE_P12_PASSWORD" --for-notarization "$TARGET" && \
"$RCODESIGN" notary-submit --api-key-file "$json_file" --staple "$TARGET"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment