rework web scripts

isolation_bkp/dynres
Dominik Madarász 2022-09-11 23:52:01 +00:00 committed by GitHub
parent f06e9d7dd2
commit 9563e0654f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 28 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ build_rel
build_web build_web
emsdk emsdk
deploy_web deploy_web
run_web
butler butler
screenshots screenshots
build.bat build.bat

View File

@ -1,17 +0,0 @@
#!/bin/bash
# Run as "source web_host.sh" to set up environment variables
# Prompt for URL
read -p "Enter URL: " URL
# Expose URL to environment
export ECO2D_SERVER_URL=${URL/https:\/\//}build_web
echo ${ECO2D_SERVER_URL}
# Symlink sources
if [ ! -d "build_web/${ECO2D_SERVER_URL}" ]; then
mkdir -p "build_web/${ECO2D_SERVER_URL}"
pushd build_web
ln -s "/workspaces/eco2d/code" "${ECO2D_SERVER_URL/build_web/}/code"
popd
fi

View File

@ -1,5 +0,0 @@
#!/bin/bash
set -xe
python -m http.server --directory build_web --bind 127.0.0.1

18
web/bind.sh 100755
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Run as "source web/host.sh" to set up environment variables
# Prompt for URL
read -p "Enter URL: " URL
# Expose URL to environment
export ECO2D_SERVER_URL=${URL/https:\/\//}run_web
echo ${ECO2D_SERVER_URL}
# Symlink sources
if [ ! -d "run_web/${ECO2D_SERVER_URL}" ]; then
mkdir -p "run_web/${ECO2D_SERVER_URL/run_/build_}"
pushd run_web
ln -s "/workspaces/eco2d/code" "${ECO2D_SERVER_URL/run_web/}/code"
ln -s "/workspaces/eco2d/build_web/_deps" "${ECO2D_SERVER_URL/run_web/}build_web/_deps"
popd
fi

11
web/build.sh 100755
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -xe
cmake --build build_web --parallel
pushd build_web
if [ -f "eco2d.html" ]; then
mv eco2d.html index.html
fi
popd

View File

@ -20,10 +20,12 @@ if [ ! -d "butler" ]; then
fi fi
# Build web # Build web
if [ -f "build_web/eco2d.html" ]; then if [ -f "build_web/index.html" ]; then
rm -rf build_web/eco2d.html rm -rf build_web/index.html
fi fi
cmake --build build_web
# Build the project
web/build.sh
# Package all assets # Package all assets
if [ ! -f "build_web/eco2d.html" ]; then if [ ! -f "build_web/eco2d.html" ]; then
@ -33,9 +35,7 @@ fi
mkdir deploy_web mkdir deploy_web
cp build_web/eco2d.* deploy_web/ cp build_web/eco2d.* deploy_web/
pushd deploy_web/ cp buiid_web/index.html deploy_web/
mv eco2d.html index.html
popd
# Deploy to itch.io # Deploy to itch.io
./butler/butler push deploy_web/ zaklaus/eco2d:html-latest ./butler/butler push deploy_web/ zaklaus/eco2d:html-latest

13
web/host.sh 100755
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -xe
if [ -d "run_web" ]; then
rm -rf run_web
fi
mkdir run_web
cp build_web/eco2d.* run_web/
cp build_web/index.html run_web/
python -m http.server --directory run_web --bind 127.0.0.1