chia-blockchain/build_scripts/build_macos-2-installer.sh

114 lines
3.6 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
set -o errexit -o nounset
git status
git submodule
# If the env variable NOTARIZE and the username and password variables are
# set, this will attempt to Notarize the signed DMG.
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
CHIA_INSTALLER_VERSION="0.0.0"
fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm utilities"
cd npm_macos || exit 1
npm ci
cd .. || exit 1
echo "Create dist/"
Electron react (#226) * clean react * add material ui * add word list * mnemonic v0 * jeepney backup * keychain usage * wallet api * mnemonic ui * mnemonics redux state * handle exceptions correctly * dashboard * wallets * get puzzle hash * tx history * sidebar * start stop wallet node * use existing mnemonics * status info * create cc wallet * theme should be outside of switch * create offer * dbus alternative for linux * key migration * don't autocomplete, don't reset simulator db * reset mnemonics * Refactor keychain, and key migration * Implement UI for changing keys * Removing keys and mnemonic button * Start making farmer and harvester RPCs * start rpx for simulator * Harvester and farmer websocket, and basic UI * Plot display and deletion * launch daemon on start * State changes from full node, harvester, farmer, and full node ui improvements * split balances in react * pending change balance * plotter * dev config * maintain connection / retry * Remove electron-ui, and style fixes * Better farmer and full node control * Remove electron ui references * Uncomment out starting the dameon * Remove timelord tab, and change full node style * Clean up new wallet login * Refactor RPCs * Now that the GH runner uses python 3.7.7 - use for windows installer * add balance split to coloured coin wallet * spendable balance fix * Import private key from UI fix * mac build/installer Co-authored-by: Mariano Sorgente <sorgente711@gmail.com> Co-authored-by: Lipa Long <lipa@chia.net> Co-authored-by: Gene Hoffman <hoffmang@hoffmang.com>
2020-05-20 10:41:10 +03:00
sudo rm -rf dist
mkdir dist
2021-03-19 01:04:22 +03:00
echo "Create executables with pyinstaller"
SPEC_FILE=$(python -c 'import sys; from pathlib import Path; path = Path(sys.argv[1]); print(path.absolute().as_posix())' "pyinstaller.spec")
pyinstaller --log-level=INFO "$SPEC_FILE"
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "pyinstaller failed!"
exit $LAST_EXIT_CODE
fi
Generate a license directory that contains licenses missing from the installers (#15146) * Add scripts to build a tree of licenses that are missing from the installers * Add a line that was accidentally removed * add steps in the build_license_directory script to install pip-licenses and license-checker * Pip install pip-license * Added commands to check the working dir in the build_license_direcotory.sh * Fix the path for the npm commands * Copy the library dir over * Add a line to cd back to the previous dir in the build_licenses_directory.sh file * Fix path to go back to "build_scripts" * Fixing a typo with a path in the build_license_directory.sh file * Troubleshoot path * Change word from library to licenses * Add a command to list contents of "dist/$CLI_DEB_BASE/opt/chia/" for troubleshooting * Copy the license file to the "GUI" directory * Fix the last for loop * Move the step to change directory back to build scripts in the build_license_directory.sh file * Add some more steps to troubleshoot the path and license-checker usage * Fix a typo * Add an "npm install ." before running the license-checker * Fix a typo * Change back to the build_scripts dir before the first loop in build_license_directory.sh file * Revert "Change back to the build_scripts dir before the first loop in build_license_directory.sh file" This reverts commit a3e88a258377f9f12cbc815245d5912e8a6f6258. * Fix the path for moving the license file * Change the first loop for printing licenses from npm license-checker * Add steps to copy the license file over to the builds and comment out the "npm install ." step out of the build_license_firectory script * Add npm ci to the build_license_directory file * Adding a dir for troubleshooting * Fix errors in the scripts * Fix a path to the licenses file * Remove a dir from the windows installer script * Remove a copy command * Remove a few more copy commands * Adding a ps1 script for usage in the windows installer build script * Replace the powershell script * Made a couple changes to the ps1 script for building the license directory * Remove the ps1 script for building the license dir * Add a new script for the windows installer to build the license dir * Fix issues with the code for windows * Remove the -1 from NF * Changing the script for windows to test * Remove filename=$(basename "$i") * Remove some ls command lines * Add "cp -r dist/daemon ../chia-blockchain-gui/packages/gui" to the RPM installer script * Remove "|| 'exit" or "cd' || return" from when CD'ing in the license creation scripts * Remove extra set of ||
2023-06-22 00:51:05 +03:00
# Creates a directory of licenses
echo "Building pip and NPM license directory"
pwd
bash ./build_license_directory.sh
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
# Change to the gui package
cd ../chia-blockchain-gui/packages/gui || exit 1
# sets the version for chia-blockchain in package.json
brew install jq
cp package.json package.json.orig
jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json
echo "Building macOS Electron app"
OPT_ARCH="--x64"
if [ "$(arch)" = "arm64" ]; then
OPT_ARCH="--arm64"
fi
PRODUCT_NAME="Chia"
if [ "$NOTARIZE" == true ]; then
echo "Setting credentials for signing"
export CSC_LINK=$APPLE_DEV_ID_APP
export CSC_KEY_PASSWORD=$APPLE_DEV_ID_APP_PASS
export PUBLISH_FOR_PULL_REQUEST=true
export CSC_FOR_PULL_REQUEST=true
else
echo "Not on ci or no secrets so not signing"
export CSC_IDENTITY_AUTO_DISCOVERY=false
fi
echo npx electron-builder build --mac "${OPT_ARCH}" --config.productName="$PRODUCT_NAME" --config.mac.minimumSystemVersion="11" --config ../../../build_scripts/electron-builder.json
npx electron-builder build --mac "${OPT_ARCH}" --config.productName="$PRODUCT_NAME" --config.mac.minimumSystemVersion="11" --config ../../../build_scripts/electron-builder.json
LAST_EXIT_CODE=$?
ls -l dist/mac*/chia.app/Contents/Resources/app.asar
# reset the package.json to the original
mv package.json.orig package.json
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-builder failed!"
exit $LAST_EXIT_CODE
fi
mv dist/* ../../../build_scripts/dist/
cd ../../../build_scripts || exit 1
mkdir final_installer
DMG_NAME="chia-${CHIA_INSTALLER_VERSION}.dmg"
if [ "$(arch)" = "arm64" ]; then
mv dist/"${DMG_NAME}" dist/chia-"${CHIA_INSTALLER_VERSION}"-arm64.dmg
DMG_NAME=chia-${CHIA_INSTALLER_VERSION}-arm64.dmg
fi
mv dist/"$DMG_NAME" final_installer/
ls -lh final_installer
if [ "$NOTARIZE" == true ]; then
echo "Notarize $DMG_NAME on ci"
cd final_installer || exit 1
xcrun notarytool submit --wait --apple-id "$APPLE_NOTARIZE_USERNAME" --password "$APPLE_NOTARIZE_PASSWORD" --team-id "$APPLE_TEAM_ID" "$DMG_NAME"
xcrun stapler staple "$DMG_NAME"
echo "Notarization step complete"
else
echo "Not on ci or no secrets 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 notarytool submit --wait --apple-id username --password password --team-id team-id Chia-0.1.X.dmg
# Wait until the command returns a success message
#
# 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