build_mac_installer.sh (1298B)
1 #!/bin/bash 2 3 script_file=Proteus.pkgproj 4 5 app_version=$(cut -f 2 -d '=' <<< "$(grep 'CMAKE_PROJECT_VERSION:STATIC' ../../build/CMakeCache.txt)") 6 echo "Setting app version: $app_version..." 7 sed -i '' "s/##APPVERSION##/${app_version}/g" $script_file 8 sed -i '' "s/##APPVERSION##/${app_version}/g" Intro.txt 9 10 echo "Copying License..." 11 cp ../../LICENSE.txt LICENSE.txt 12 13 # build installer 14 echo Building... 15 /usr/local/bin/packagesbuild $script_file 16 17 # reset version number 18 sed -i '' "s/${app_version}/##APPVERSION##/g" $script_file 19 sed -i '' "s/${app_version}/##APPVERSION##/g" Intro.txt 20 21 # clean up license file 22 rm LICENSE.txt 23 24 # sign the installer package 25 echo "Signing installer package..." 26 TEAM_ID=$(more ~/Developer/mac_id) 27 pkg_dir=Proteus_Installer_Packaged 28 rm -Rf $pkg_dir 29 mkdir $pkg_dir 30 productsign -s "$TEAM_ID" ../../build/Proteus.pkg $pkg_dir/Proteus-signed.pkg 31 32 echo "Notarizing installer package..." 33 INSTALLER_PASS=$(more ~/Developer/mac_installer_pass) 34 npx notarize-cli --file $pkg_dir/Proteus-signed.pkg --bundle-id com.GuitarML.Proteus --asc-provider "$TEAM_ID" --username [email protected] --password "$INSTALLER_PASS" 35 36 echo "Building disk image..." 37 vol_name=Install_Proteus-$app_version 38 hdiutil create "$vol_name.dmg" -fs HFS+ -srcfolder $pkg_dir -format UDZO -volname "$vol_name"