Skip to content

Commit

Permalink
Installer Fixes - New UI (Chia-Network#9506)
Browse files Browse the repository at this point in the history
* Update to node 16

* Install lerna globally. Lerna clean, and comment out audit:fix for now since it doesn't work with Lerna (see lerna/lerna#1663)

* Global lerna in build mac as well

* Test building the gui package, instead of from the root

* Build installer from the gui package and copy daemon folder to the correct place

* Pass executable name / options.name to linux installers

* Move installers to the root of blockchain-gui

* Fix winstaller

* Latest NEXT

* Update to latest UI

* Copy signing cert for windows to proper location
  • Loading branch information
cmmarslender authored Dec 8, 2021
1 parent 9217993 commit 313cf27
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-linux-installer-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ jobs:
run: |
sh install.sh
- name: Setup Node 12.x
- name: Setup Node 16.x
uses: actions/[email protected]
with:
node-version: '12.x'
node-version: '16.x'

- name: Add jq
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-macos-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ jobs:
run: |
sh install.sh
- name: Setup Node 14.x
- name: Setup Node 16.x
uses: actions/[email protected]
with:
node-version: '14.x'
node-version: '16.x'

- name: Build MacOS DMG in Catalina
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-macos-m1-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ jobs:
run: |
arch -arm64 sh install.sh
- name: Install node 14.x
- name: Install node 16.x
run: |
arch -arm64 brew install node@14
arch -arm64 brew install node@16
- name: Build MacOS DMG
env:
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
run: |
export PATH=$(brew --prefix node@14)/bin:$PATH
export PATH=$(brew --prefix node@16)/bin:$PATH
. ./activate
cd ./chia-blockchain-gui
arch -arm64 git status
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build-windows-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
with:
python-version: "3.9"

- name: Setup Node 16.x
uses: actions/[email protected]
with:
node-version: '16.x'

- name: Test for secrets access
id: check_secrets
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
displayName: "Setup Node 14.x"
versionSpec: '16.x'
displayName: "Setup Node 16.x"

- bash: |
. ./activate
Expand Down
18 changes: 12 additions & 6 deletions build_scripts/build_linux_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-debian -g
npm install lerna -g

echo "Create dist/"
rm -rf dist
Expand All @@ -41,27 +42,32 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

cp -r dist/daemon ../chia-blockchain-gui
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
cd .. || exit
cd chia-blockchain-gui || exit

echo "npm build"
lerna clean -y
npm install
npm audit fix
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "npm run build failed!"
exit $LAST_EXIT_CODE
fi

# Change to the gui package
cd packages/gui || exit

# sets the version for chia-blockchain in package.json
cp package.json package.json.orig
jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json

electron-packager . chia-blockchain --asar.unpack="**/daemon/**" --platform=linux \
--icon=src/assets/img/Chia.icns --overwrite --app-bundle-id=net.chia.blockchain \
--appVersion=$CHIA_INSTALLER_VERSION
--appVersion=$CHIA_INSTALLER_VERSION --executable-name=chia-blockchain
LAST_EXIT_CODE=$?

# reset the package.json to the original
Expand All @@ -72,14 +78,14 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

mv $DIR_NAME ../build_scripts/dist/
cd ../build_scripts || exit
mv $DIR_NAME ../../../build_scripts/dist/
cd ../../../build_scripts || exit

echo "Create chia-$CHIA_INSTALLER_VERSION.deb"
rm -rf final_installer
mkdir final_installer
electron-installer-debian --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$PLATFORM" --options.version $CHIA_INSTALLER_VERSION
--arch "$PLATFORM" --options.version $CHIA_INSTALLER_VERSION --options.bin chia-blockchain --options.name chia-blockchain
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-installer-debian failed!"
Expand Down
18 changes: 12 additions & 6 deletions build_scripts/build_linux_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-redhat -g
npm install lerna -g

echo "Create dist/"
rm -rf dist
Expand All @@ -42,27 +43,32 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

cp -r dist/daemon ../chia-blockchain-gui
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
cd .. || exit
cd chia-blockchain-gui || exit

echo "npm build"
lerna clean -y
npm install
npm audit fix
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "npm run build failed!"
exit $LAST_EXIT_CODE
fi

# Change to the gui package
cd packages/gui || exit

# sets the version for chia-blockchain in package.json
cp package.json package.json.orig
jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json

electron-packager . chia-blockchain --asar.unpack="**/daemon/**" --platform=linux \
--icon=src/assets/img/Chia.icns --overwrite --app-bundle-id=net.chia.blockchain \
--appVersion=$CHIA_INSTALLER_VERSION
--appVersion=$CHIA_INSTALLER_VERSION --executable-name=chia-blockchain
LAST_EXIT_CODE=$?

# reset the package.json to the original
Expand All @@ -73,8 +79,8 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

mv $DIR_NAME ../build_scripts/dist/
cd ../build_scripts || exit
mv $DIR_NAME ../../../build_scripts/dist/
cd ../../../build_scripts || exit

if [ "$REDHAT_PLATFORM" = "x86_64" ]; then
echo "Create chia-blockchain-$CHIA_INSTALLER_VERSION.rpm"
Expand All @@ -98,7 +104,7 @@ if [ "$REDHAT_PLATFORM" = "x86_64" ]; then

electron-installer-redhat --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$REDHAT_PLATFORM" --options.version $CHIA_INSTALLER_VERSION \
--license ../LICENSE
--license ../LICENSE --options.bin chia-blockchain --options.name chia-blockchain
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-installer-redhat failed!"
Expand Down
14 changes: 10 additions & 4 deletions build_scripts/build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ npm install electron-installer-dmg -g
npm install [email protected] -g
npm install [email protected] -g
npm install notarize-cli -g
npm install lerna -g

echo "Create dist/"
sudo rm -rf dist
Expand All @@ -36,20 +37,25 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "pyinstaller failed!"
exit $LAST_EXIT_CODE
fi
cp -r dist/daemon ../chia-blockchain-gui
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
cd .. || exit
cd chia-blockchain-gui || exit

echo "npm build"
lerna clean -y
npm install
npm audit fix
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "npm run build failed!"
exit $LAST_EXIT_CODE
fi

# Change to the gui package
cd packages/gui || exit

# sets the version for chia-blockchain in package.json
brew install jq
cp package.json package.json.orig
Expand Down Expand Up @@ -80,8 +86,8 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

mv Chia-darwin-x64 ../build_scripts/dist/
cd ../build_scripts || exit
mv Chia-darwin-x64 ../../../build_scripts/dist/
cd ../../../build_scripts || exit

DMG_NAME="Chia-$CHIA_INSTALLER_VERSION.dmg"
echo "Create $DMG_NAME"
Expand Down
14 changes: 10 additions & 4 deletions build_scripts/build_macos_m1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ npm install electron-installer-dmg -g
npm install [email protected] -g
npm install [email protected] -g
npm install notarize-cli -g
npm install lerna -g

echo "Create dist/"
sudo rm -rf dist
Expand All @@ -38,20 +39,25 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "pyinstaller failed!"
exit $LAST_EXIT_CODE
fi
cp -r dist/daemon ../chia-blockchain-gui
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
cd .. || exit
cd chia-blockchain-gui || exit

echo "npm build"
lerna clean -y
npm install
npm audit fix
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "npm run build failed!"
exit $LAST_EXIT_CODE
fi

# Change to the gui package
cd packages/gui || exit

# sets the version for chia-blockchain in package.json
brew install jq
cp package.json package.json.orig
Expand Down Expand Up @@ -82,8 +88,8 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

mv Chia-darwin-arm64 ../build_scripts/dist/
cd ../build_scripts || exit
mv Chia-darwin-arm64 ../../../build_scripts/dist/
cd ../../../build_scripts || exit

DMG_NAME="Chia-$CHIA_INSTALLER_VERSION-arm64.dmg"
echo "Create $DMG_NAME"
Expand Down
20 changes: 17 additions & 3 deletions build_scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,24 @@ pyinstaller --log-level INFO $SPEC_FILE
Write-Output " ---"
Write-Output "Copy chia executables to chia-blockchain-gui\"
Write-Output " ---"
Copy-Item "dist\daemon" -Destination "..\chia-blockchain-gui\" -Recurse
Copy-Item "dist\daemon" -Destination "..\chia-blockchain-gui\packages\gui\" -Recurse
Set-Location -Path "..\chia-blockchain-gui" -PassThru
# We need the code sign cert in the gui subdirectory so we can actually sign the UI package
Copy-Item "win_code_sign_cert.p12" -Destination "packages\gui\"

git status

Write-Output " ---"
Write-Output "Prepare Electron packager"
Write-Output " ---"
$Env:NODE_OPTIONS = "--max-old-space-size=3000"
npm install --save-dev electron-winstaller
npm install -g electron-packager
npm install -g lerna

lerna clean -y
npm install
npm audit fix
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix

git status

Expand All @@ -110,6 +115,9 @@ If ($LastExitCode -gt 0){
Throw "npm run build failed!"
}

# Change to the GUI directory
Set-Location -Path "packages\gui" -PassThru

Write-Output " ---"
Write-Output "Increase the stack for chia command for (chia plots create) chiapos limitations"
# editbin.exe needs to be in the path
Expand Down Expand Up @@ -154,6 +162,12 @@ If ($env:HAS_SECRET) {

git status

Write-Output " ---"
Write-Output "Moving final installers to expected location"
Write-Output " ---"
Copy-Item ".\Chia-win32-x64" -Destination "$env:GITHUB_WORKSPACE\chia-blockchain-gui\" -Recurse
Copy-Item ".\release-builds" -Destination "$env:GITHUB_WORKSPACE\chia-blockchain-gui\" -Recurse

Write-Output " ---"
Write-Output "Windows Installer complete"
Write-Output " ---"
2 changes: 1 addition & 1 deletion build_scripts/clean-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cd "$PWD" || true

# Do our best to get rid of any globally installed notarize-cli versions so the version in the current build script is
# installed without conflicting with the other version that might be installed
PATH=$(brew --prefix node@14)/bin:$PATH || true
PATH=$(brew --prefix node@16)/bin:$PATH || true
export PATH
npm uninstall -g notarize-cli || true
npm uninstall -g @chia-network/notarize-cli || true
Expand Down
2 changes: 1 addition & 1 deletion chia-blockchain-gui

0 comments on commit 313cf27

Please sign in to comment.