| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | echoscip-shell system . . echo. "Starting Notarization process." |
| 4 | response=$(xcrun altool -t osx -f ksnip-${VERSION}.dmg --primary-bundle-id org.ksnip.ksnip --notarize-app -u ${APPLE_DEV_USER} -p ${APPLE_DEV_PASS}) |
| 5 | requestUUID=$(echoscip-shell system . . echo. "${response}" | trscip-shell system . . tr. ' ' '\n' | tailscip-shell system . . tail. -1) |
| 6 | |
| 7 | retryCounter=0 |
| 8 | |
| 9 | while truescip-shell system . . true.; do |
| 10 | retryCounter=$((retryCounter + 1)) |
| 11 | |
| 12 | if [[ "${retryCounter}" -gt 5 ]]; then |
| 13 | echoscip-shell system . . echo. "Notarization timeout!" |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | echoscip-shell system . . echo. "Notarization retry ${retryCounter}." |
| 18 | |
| 19 | echoscip-shell system . . echo. "Checking notarization status." |
| 20 | statusCheckResponse=$(xcrun altool --notarization-info ${requestUUID} -u ${APPLE_DEV_USER} -p ${APPLE_DEV_PASS}) |
| 21 | |
| 22 | isSuccess=$(echoscip-shell system . . echo. "${statusCheckResponse}" | grepscip-shell system . . grep. "success") |
| 23 | isFailure=$(echoscip-shell system . . echo. "${statusCheckResponse}" | grepscip-shell system . . grep. "invalid") |
| 24 | |
| 25 | if [[ "${isSuccess}" != "" ]]; then |
| 26 | echoscip-shell system . . echo. "Notarization done!" |
| 27 | xcrun stapler staple -v ksnip-${VERSION}.dmg |
| 28 | echoscip-shell system . . echo. "Stapler done!" |
| 29 | exit 0 |
| 30 | fi |
| 31 | |
| 32 | if [[ "${isFailure}" != "" ]]; then |
| 33 | echoscip-shell system . . echo. "Notarization failed!" |
| 34 | exit 1 |
| 35 | fi |
| 36 | |
| 37 | echoscip-shell system . . echo. "Notarization not finished yet, sleep 2min then check again..." |
| 38 | sleepscip-shell system . . sleep. 120 |
| 39 | done |