Files
upgrading-ethereum-book/bin/util/publish.sh
2025-05-23 19:54:09 +01:00

48 lines
798 B
Bash
Executable File

#!/bin/bash
version=$(git branch --show-current 2>/dev/null || echo 'unknown')
wait_for_input () {
read -s < /dev/tty
}
was_it_ok () {
if [ $1 -ne 0 ]
then
echo "Exiting: $2 failed."
exit 1
fi
}
echo
echo "*** Publishing to path $version ***"
cd $(dirname "$0")/../..
# Set the host variable
source bin/priv/server.sh
echo
echo "*** Building site..."
npm run clean
npm run build
was_it_ok $? "npm run build"
echo
echo "*** Building PDF..."
bin/pdf/make_pdf src/book.md
was_it_ok $? "make_pdf"
mv book.pdf dist/
echo
echo "*** Ready to upload - press [ENTER] to continue"
wait_for_input
tar zcf - dist | ssh $host tar zxfC - eth2book
echo
echo "*** Ready to install - press [ENTER] to continue"
wait_for_input
ssh $host eth2book/install_astro.sh $version