#!/bin/bash
# How to notarize

echo "Ask for username and password - password should be an app specific password"
# Generate app specific password https://support.apple.com/en-us/HT204397
xcrun altool --notarize-app -f Chia-0.1.X.dmg --primary-bundle-id net.chia.blockchain -u username -p password
echo "xcrun altool --notarize-app; -should return REQUEST-ID, use it in next command"

echo "Wait until following command return a success message"
watch -n 20 'xcrun altool --notarization-info  {REQUEST-ID} -u username -p password'
echo "It can take a while, run it every few minutes"


echo "Once that is successful, execute the following command"
xcrun stapler staple Chia-0.1.X.dmg

echo "Validate DMG"
xcrun stapler validate Chia-0.1.X.dmg
