github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/updater/osx/build.sh (about) 1 #!/bin/bash 2 3 set -e -u -o pipefail # Fail on error 4 5 dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 6 cd "$dir" 7 8 app_name="KeybaseUpdater" 9 plist="$dir/Updater/Info.plist" 10 scheme="Updater" 11 code_sign_identity=${CODE_SIGN_IDENTITY:-"90524F7BEAEACD94C7B473787F4949582F904104"} 12 xcode_configuration="Release" 13 install_app_path="/Applications/Keybase.app/Contents/Resources/$app_name.app" 14 15 build_dir="$dir/build" 16 mkdir -p "$build_dir" 17 archive_path="$build_dir/$app_name.xcarchive" 18 19 echo "Plist: $plist" 20 app_version="`/usr/libexec/plistBuddy -c "Print :CFBundleShortVersionString" $plist`" 21 22 echo "Archiving" 23 xcodebuild archive -scheme "$scheme" -project "$dir/Updater.xcodeproj" -configuration "$xcode_configuration" -archivePath "$archive_path" | xcpretty -c 24 25 echo "Exporting" 26 tmp_dir="/tmp" 27 tmp_app_path="$tmp_dir/$app_name.app" 28 export_dest="$tmp_dir/updater-build" 29 rm -rf "$tmp_app_path" 30 rm -rf "$export_dest" 31 xcodebuild -exportArchive -archivePath "$archive_path" -exportOptionsPlist export.plist -exportPath "$export_dest" | xcpretty -c 32 mv "$export_dest/Updater.app" "$tmp_app_path" 33 echo "Exported to $tmp_app_path" 34 35 echo "Codesigning with $code_sign_identity" 36 codesign --verbose --force --deep --timestamp --options runtime --sign "$code_sign_identity" "$tmp_app_path" 37 echo "Checking codesigning..." 38 codesign -dvvvv "$tmp_app_path" 39 echo " " 40 spctl --assess --verbose=4 "$tmp_app_path" 41 echo " " 42 43 cd "$tmp_dir" 44 tgz="$app_name-$app_version-darwin.tgz" 45 echo "Packing $tgz" 46 tar zcvpf "$tgz" "$app_name.app" 47 echo "Created $tmp_dir/$tgz" 48 49 rm -rf "$install_app_path" 50 cp -R "$tmp_app_path" "$install_app_path" 51 echo "Copied $tmp_app_path to $install_app_path"