2022-09-11 19:58:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
|
|
|
if [ ! -d "build_web" ]; then
|
|
|
|
echo "Build directory not found. Run setup_web.sh first."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "butler" ]; then
|
|
|
|
mkdir butler
|
|
|
|
wget https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default -O butler.zip
|
|
|
|
mv butler.zip butler/
|
|
|
|
pushd butler/
|
|
|
|
unzip butler.zip
|
|
|
|
rm -rf butler.zip
|
|
|
|
chmod +x ./butler
|
|
|
|
./butler -V
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build web
|
2022-09-11 23:52:01 +00:00
|
|
|
if [ -f "build_web/index.html" ]; then
|
|
|
|
rm -rf build_web/index.html
|
2022-09-11 19:58:30 +00:00
|
|
|
fi
|
2022-09-11 23:52:01 +00:00
|
|
|
|
|
|
|
# Build the project
|
|
|
|
web/build.sh
|
2022-09-11 19:58:30 +00:00
|
|
|
|
|
|
|
# Package all assets
|
2022-09-12 07:02:12 +00:00
|
|
|
if [ ! -f "build_web/index.html" ]; then
|
2022-09-11 19:58:30 +00:00
|
|
|
echo "Build data not found. Compilation errors?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-12 07:02:12 +00:00
|
|
|
mkdir -p deploy_web
|
2022-09-11 19:58:30 +00:00
|
|
|
cp build_web/eco2d.* deploy_web/
|
2022-09-12 07:02:12 +00:00
|
|
|
cp build_web/index.html deploy_web/
|
2022-09-11 19:58:30 +00:00
|
|
|
|
|
|
|
# Deploy to itch.io
|
|
|
|
./butler/butler push deploy_web/ zaklaus/eco2d:html-latest
|
|
|
|
|
|
|
|
# Teardown
|
|
|
|
rm -rf deploy_web
|