- scriptText = "# notarytool credentials. # AC_PASSWORD is the name of the keychain item created with `notarytool store-credentials`. # Grant keychain access to Xcode if prompted by Xcode. AC_PASSWORD="nt_password" # Do all of the work in a subdirectory of /tmp, and use a # unique ID so that there's no collision with previous builds. ##EXPORT_UUID=`uuidgen` ##EXPORT_PATH="/tmp/$PRODUCT_NAME-$EXPORT_UUID/" ## create folder to hold exported app newMajor="$(date -u +%Y%m%d)" date24H=$(date -u +%H%M) tmpMinor=$(printf "%x\n" $(echo $date24H | sed 's/^0*//')) newMinor=$(echo $tmpMinor | tr '[:lower:]' '[:upper:]') newBuildNumber="$newMajor-$newMinor" shortVer="v${MARKETING_VERSION}" exeName="${EXECUTABLE_NAME}" EXPORT_PATH="/Users/lesliehelou/Documents/Travel/- Projects/$exeName/$shortVer/$newBuildNumber" APP_PATH="$EXPORT_PATH/$PRODUCT_NAME.app" DMG_PATH="$EXPORT_PATH/$PRODUCT_NAME_${shortVer}.dmg" ZIP_PATH="$EXPORT_PATH/${PRODUCT_NAME}_${shortVer}.zip" mkdir -p "$EXPORT_PATH" # Xcode doesn't show run script errors in build log. exec > "$EXPORT_PATH/Xcode run script.log" 2>&1 open "$EXPORT_PATH/Xcode run script.log" # Use osascript(1) to present notification banners; otherwise # there's no progress indication until the script finishes. /usr/bin/osascript -e 'display notification "Exporting application archive…" with title "Submitting app for notarization"' # Ask xcodebuild(1) to export the app. Use the export options # from a previous manual export that used a Developer ID. ##/usr/bin/xcodebuild -exportArchive -archivePath "$ARCHIVE_PATH" -exportOptionsPlist "$SRCROOT/ExportOptions.plist" -exportPath "$EXPORT_PATH" /usr/bin/xcodebuild -exportArchive -archivePath "$ARCHIVE_PATH" -exportOptionsPlist "/Users/lesliehelou/Documents/GitHub/ExportOptions.plist" -exportPath "$EXPORT_PATH/" osascript -e 'display notification "Creating UDIF Disk Image…" with title "Submitting app for notarization"' # Create a UDIF bzip2-compressed disk image. cd "$EXPORT_PATH/" mkdir "$PRODUCT_NAME" mv -v "$APP_PATH" "$PRODUCT_NAME" /usr/bin/hdiutil create -srcfolder "$PRODUCT_NAME" -format UDBZ "$DMG_PATH" osascript -e 'display notification "Submitting UDIF Disk Image for notarization…" with title "Submitting app for notarization"' # Submit the finished deliverables for notarization. # Wait up to 2 hours for a response. # Use verbose logging in order to file feedback if an error occurs. ## "$DEVELOPER_BIN_DIR/notarytool" submit -p "$AC_PASSWORD" --verbose "$DMG_PATH" --wait --timeout 2h --output-format plist > "NotarizationResponse.plist" "/Applications/Xcode.app/Contents/Developer/usr/bin/notarytool" submit -p "$AC_PASSWORD" --verbose "$DMG_PATH" --wait --timeout 2h --output-format plist > "NotarizationResponse.plist" return_code=$? if [ $return_code -eq 0 ]; then message=`/usr/libexec/PlistBuddy -c "Print :message" "NotarizationResponse.plist"` status=`/usr/libexec/PlistBuddy -c "Print :status" "NotarizationResponse.plist"` else message="An Error Occurred." status="Check Xcode log." ## open "$EXPORT_PATH/Xcode run script.log" fi # Show and speak the final status. osascript -e "on run(argv)" \ -e 'display notification item 1 of argv & " : " & item 2 of argv with title "Submitting app for notarization" sound name "Crystal"' \ -e 'set text item delimiters to ", "' \ -e "set args to argv as text" \ -e "say args" \ -e "delay 5" \ -e "end" \ -- "$message" "$status" wait 5 xcrun stapler staple "$PRODUCT_NAME/$PRODUCT_NAME.app" xcrun stapler staple "$PRODUCT_NAME.dmg" if [ -e "$ZIP_PATH" ];then rm -f "$ZIP_PATH" fi /usr/bin/ditto -c -k --keepParent "$PRODUCT_NAME/$PRODUCT_NAME.app" "$ZIP_PATH" # Open the folder that was created, which also signals completion. open "$EXPORT_PATH" ">
0 commit comments