WebFun is hosted on GitHub pages using the branch release with a custom domain. The deployment process takes several steps, automated by this simple shell script:

#!/usr/bin/env bash


# Stop on errors
set -e

# Clone release branch to $TARGET if it does not exist
if [ ! -d "$TARGET" ]; then
	git clone -b release "$TARGET"

# Change to project root
cd "$SOURCE"

# Execute full test suite
yarn test:full

# Set environment variable to load game files from
export WEBFUN_GAMES="[{\"title\":\"Yoda Stories from\",\"variant\":\"yoda\",\"sfx-format\":\"wav\",\"exe\":\"\",\"sfx\":\"\",\"data\":\"\",\"help\":\"\"},{\"title\":\"Yoda Stories Demo (\",\"variant\":\"yoda-demo\",\"sfx-format\":\"wav\",\"exe\":\"\",\"sfx\":\"\",\"data\":\"\",\"help\":\"\"}]"

# Run production build
yarn build

# Run production build of documentation
yarn build:docs

# Build docker container for local deployment
# docker build -t webfun:latest .

# Clear out target directory
rm -r "$TARGET"/*

# Copy release files
cp -r build/* "$TARGET"

# Copy screenshots for landing page
cp -r docs/screenshots "$TARGET"/docs/screenshots
cp -r assets/preview.png "$TARGET"/preview.png

# Re-create CNAME to setup custom URL for GitHub pages
echo -n > "$TARGET"/CNAME

# Change directory for manual inspection
cd "$TARGET"

# Stage new version
git add .

# Give further instructions
echo ""
echo "Your relase is ready. Please inspect changes manually and the run"
echo ""
echo "   cd \"$TARGET\""
echo "   git commit -m \"chore: Update release\""
echo "   git push"
echo ""