view tools/make_dist.sh @ 28:b0658e7fcee2

Added tag 0.9.1 for changeset 75deda08db90
author ark
date 2026-10-20 17:19 +0200
parents 75deda08db90
children a464bd43b76c
line wrap: on
line source

#!/bin/sh
USAGE="$0 [--debug]

build the game and pack www/ into dist/minor_monsters_<version>.tar.gz,
which unpacks into a directory minor_monsters. the version comes from
tools/get_version.sh -f: the latest tag, with a timestamp appended when
the working directory is not clean or not at the tagged revision.

options:
    -h, --help  show this help
    --debug     build with the debug code and switches, not as a release
"

DEBUG=0

while [ "$#" != 0 ]
do
    case "$1" in
        -h|--help) echo "$USAGE"; exit 0 ;;
        --debug) DEBUG=1 ;;
        *)
            echo "unrecognized option '$1'" >&2
            exit 1
            ;;
    esac
    shift
done

# build.py and get_version.sh work on the repository root
cd "$(dirname "$0")/.." &&
if [ "$DEBUG" = 1 ]
then
    python3 tools/build.py
else
    python3 tools/build.py --release
fi &&
VERSION=$(tools/get_version.sh -f) &&
ARCHIVE="dist/minor_monsters_$VERSION.tar.gz" &&
mkdir -p dist &&
# www/ is stored as minor_monsters/
tar --no-xattrs --no-mac-metadata --exclude .DS_Store -s ',^www,minor_monsters,' \
    -czf "$ARCHIVE" www &&
echo "wrote $ARCHIVE"