Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deployment

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

#!/usr/bin/env bash

declare -r SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
declare -r PROJECT_DIR=$(realpath "$SCRIPT_DIR/../../../")
declare -r REPO_NAME=$(basename "${SCRIPT_DIR}")

SOURCE="$PROJECT_DIR/"
TARGET="$PROJECT_DIR.page/"
BRANCH="pages"
REPO="https://codeberg.org/cyco/WebFun.git"

# Stop on errors
set -euo pipefail

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

# Change to project root
pushd "$SOURCE" || exit 1

# Execute full test suite
# TODO: Execute tests to make sure everything works as expected
# npm run test:full

# Set environment variable to load game files from archive.org
export WEBFUN_GAMES="[{\"title\":\"Yoda Stories from archive.org\",\"variant\":\"yoda\",\"sfx-format\":\"wav\",\"exe\":\"https://cors.archive.org/download/Star_Wars_-_Yoda_Stories_1997_LucasArts/Star%20Wars%20-%20Yoda%20Stories%20%281997%29%28LucasArts%29.iso/Yoda%2FYodesk.exe\",\"sfx\":\"https://cors.archive.org/download/Star_Wars_-_Yoda_Stories_1997_LucasArts/Star%20Wars%20-%20Yoda%20Stories%20%281997%29%28LucasArts%29.iso/Yoda%2Fsfx%2F\",\"data\":\"https://cors.archive.org/download/Star_Wars_-_Yoda_Stories_1997_LucasArts/Star%20Wars%20-%20Yoda%20Stories%20%281997%29%28LucasArts%29.iso/Yoda%2Fyodesk.dta\",\"help\":\"https://cors.archive.org/download/Star_Wars_-_Yoda_Stories_1997_LucasArts/Star%20Wars%20-%20Yoda%20Stories%20%281997%29%28LucasArts%29.iso/Yoda%2FYodesk.hlp\"},{\"title\":\"Yoda Stories Demo (archive.org)\",\"variant\":\"yoda-demo\",\"sfx-format\":\"wav\",\"exe\":\"https://cors.archive.org/download/StarWarsYodaStories_1020/YodaDemo.zip/YodaDemo%2FYodaDemo.exe\",\"sfx\":\"https://archive.org/download/StarWarsYodaStories_1020/YodaDemo.zip/YodaDemo%2Fsfx%2F\",\"data\":\"https://cors.archive.org/download/StarWarsYodaStories_1020/YodaDemo.zip/YodaDemo%2FYodaDemo.dta\",\"help\":\"https://cors.archive.org/download/StarWarsYodaStories_1020/YodaDemo.zip/YodaDemo%2FYodaDemo.hlp\"}]"

# Run production build
npm run build

# Run production build of documentation
npm run 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 domains file for codeberg
echo webfun.io >"$TARGET"/.domains
echo www.webfun.io >>"$TARGET"/.domains

# Change directory for manual inspection
pushd "$TARGET" || exit 1

# Stage new version
git add .

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