2020-05-23 23:41:19 +03:00
|
|
|
#!/bin/bash
|
2020-06-25 05:26:52 +03:00
|
|
|
pip install setuptools_scm
|
2020-06-07 02:18:43 +03:00
|
|
|
# The environment variable CHIA_INSTALLER_VERSION needs to be defined
|
2020-12-24 12:43:36 +03:00
|
|
|
# If the env variable NOTARIZE and the username and password variables are
|
|
|
|
# set, this will attempt to Notarize the signed DMG
|
2020-06-07 02:18:43 +03:00
|
|
|
CHIA_INSTALLER_VERSION=$(python installer-version.py)
|
|
|
|
|
2020-06-24 06:47:06 +03:00
|
|
|
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
2020-11-01 05:35:04 +03:00
|
|
|
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
|
|
|
CHIA_INSTALLER_VERSION="0.0.0"
|
2020-06-05 07:45:30 +03:00
|
|
|
fi
|
2020-06-07 02:18:43 +03:00
|
|
|
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
|
2020-06-05 07:45:30 +03:00
|
|
|
|
2020-05-23 23:41:19 +03:00
|
|
|
echo "Installing npm and electron packagers"
|
2020-05-20 10:41:10 +03:00
|
|
|
npm install electron-installer-dmg -g
|
|
|
|
npm install electron-packager -g
|
2020-12-23 07:22:55 +03:00
|
|
|
npm install electron/electron-osx-sign -g
|
2020-12-24 12:43:36 +03:00
|
|
|
npm install notarize-cli -g
|
2020-05-23 23:41:19 +03:00
|
|
|
|
|
|
|
echo "Create dist/"
|
2020-05-20 10:41:10 +03:00
|
|
|
sudo rm -rf dist
|
|
|
|
mkdir dist
|
2020-05-23 23:41:19 +03:00
|
|
|
|
|
|
|
echo "Create executeables with pyinstaller"
|
2021-01-13 23:54:57 +03:00
|
|
|
pip install pyinstaller==4.2
|
2020-06-19 04:12:43 +03:00
|
|
|
sudo pyinstaller --log-level=INFO daemon.spec
|
2020-05-20 10:41:10 +03:00
|
|
|
cp -r dist/daemon ../electron-react
|
2020-06-24 06:47:06 +03:00
|
|
|
cd .. || exit
|
|
|
|
cd electron-react || exit
|
2020-05-23 23:41:19 +03:00
|
|
|
|
|
|
|
echo "npm build"
|
2020-05-22 02:10:02 +03:00
|
|
|
npm install
|
2021-01-12 23:22:06 +03:00
|
|
|
npm run locale:extract
|
|
|
|
npm run locale:compile
|
2020-11-14 03:52:14 +03:00
|
|
|
npm run build
|
2020-11-01 05:01:56 +03:00
|
|
|
LAST_EXIT_CODE=$?
|
|
|
|
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
2020-11-01 05:35:04 +03:00
|
|
|
echo >&2 "npm run build failed!"
|
|
|
|
exit $LAST_EXIT_CODE
|
2020-11-01 05:01:56 +03:00
|
|
|
fi
|
2021-01-10 01:55:10 +03:00
|
|
|
|
2020-12-24 12:43:36 +03:00
|
|
|
electron-packager . Chia --asar.unpack="**/daemon/**" --platform=darwin \
|
|
|
|
--icon=src/assets/img/Chia.icns --overwrite --app-bundle-id=net.chia.blockchain \
|
|
|
|
--appVersion=$CHIA_INSTALLER_VERSION
|
2021-01-10 01:55:10 +03:00
|
|
|
LAST_EXIT_CODE=$?
|
|
|
|
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|
|
|
echo >&2 "electron-packager failed!"
|
|
|
|
exit $LAST_EXIT_CODE
|
|
|
|
fi
|
2020-12-24 12:43:36 +03:00
|
|
|
|
|
|
|
electron-osx-sign Chia-darwin-x64/Chia.app --platform=darwin \
|
|
|
|
--hardened-runtime=true --provisioning-profile=chiablockchain.provisionprofile \
|
|
|
|
--entitlements=entitlements.mac.plist --entitlements-inherit=entitlements.mac.plist \
|
|
|
|
--no-gatekeeper-assess
|
2021-01-10 01:55:10 +03:00
|
|
|
LAST_EXIT_CODE=$?
|
|
|
|
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|
|
|
echo >&2 "electron-osx-sign failed!"
|
|
|
|
exit $LAST_EXIT_CODE
|
|
|
|
fi
|
2020-12-24 12:43:36 +03:00
|
|
|
|
2020-05-22 02:10:02 +03:00
|
|
|
mv Chia-darwin-x64 ../build_scripts/dist/
|
2020-06-24 06:47:06 +03:00
|
|
|
cd ../build_scripts || exit
|
2020-05-23 23:41:19 +03:00
|
|
|
|
2020-12-24 12:43:36 +03:00
|
|
|
DMG_NAME="Chia-$CHIA_INSTALLER_VERSION.dmg"
|
|
|
|
echo "Create $DMG_NAME"
|
2020-06-07 02:18:43 +03:00
|
|
|
mkdir final_installer
|
2020-12-24 12:43:36 +03:00
|
|
|
electron-installer-dmg dist/Chia-darwin-x64/Chia.app Chia-$CHIA_INSTALLER_VERSION \
|
|
|
|
--overwrite --out final_installer
|
2021-01-10 01:55:10 +03:00
|
|
|
LAST_EXIT_CODE=$?
|
|
|
|
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|
|
|
echo >&2 "electron-installer-dmg failed!"
|
|
|
|
exit $LAST_EXIT_CODE
|
|
|
|
fi
|
2020-12-24 12:43:36 +03:00
|
|
|
|
|
|
|
if [ "$NOTARIZE" ]; then
|
|
|
|
echo "Notarize $DMG_NAME on ci"
|
2020-12-25 02:18:10 +03:00
|
|
|
cd final_installer || exit
|
2020-12-24 12:43:36 +03:00
|
|
|
notarize-cli --file=$DMG_NAME --bundle-id net.chia.blockchain \
|
2020-12-25 02:18:10 +03:00
|
|
|
--username "$APPLE_NOTARIZE_USERNAME" --password "$APPLE_NOTARIZE_PASSWORD"
|
2020-12-24 12:43:36 +03:00
|
|
|
echo "Notarization step complete"
|
|
|
|
else
|
|
|
|
echo "Not on ci so skipping Notarize"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Notes on how to manually notarize
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# xcrun altool --notarize-app; -should return REQUEST-ID, use it in next command
|
|
|
|
#
|
|
|
|
# Wait until following command return a success message"
|
|
|
|
# watch -n 20 'xcrun altool --notarization-info {REQUEST-ID} -u username -p password'
|
|
|
|
# It can take a while, run it every few minutes
|
|
|
|
#
|
|
|
|
# Once that is successful, execute the following command"
|
|
|
|
# xcrun stapler staple Chia-0.1.X.dmg
|
|
|
|
#
|
|
|
|
# Validate DMG
|
|
|
|
# xcrun stapler validate Chia-0.1.X.dmg
|