This commit is contained in:
2026-05-28 19:29:00 +02:00
parent 33adc53e5a
commit 8a2e61929f
2 changed files with 19 additions and 19 deletions
+18 -18
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# build.sh — egy lépésben előállítja a dist/ mappába mindazt, amit a Makefile
# (export + ci-upload) felscp-zne: a HTML/WASM zip-et és a metadata.json-t.
# Magát a feltöltést NEM végzi el.
# build.sh — produces in a single step everything in the dist/ folder that the
# Makefile (export + ci-upload) would scp up: the HTML/WASM zip and the
# metadata.json. It does NOT perform the upload itself.
#
# ./build.sh # verzió a metadata.json-ból (1.0.0)
# ./build.sh 1.2.3 # verzió felülírása argumentummal
# ./build.sh # version from metadata.json (1.0.0)
# ./build.sh 1.2.3 # override version via argument
# -----------------------------------------------------------------------------
set -euo pipefail
@@ -16,16 +16,16 @@ DIST_DIR="dist"
WASM_NAME="game.wasm"
INDEX_HTML_URL="https://git.teletype.hu/tools/ebitengine-tools/raw/branch/master/web/index.html"
# --- verzió meghatározása (arg > metadata.json) -----------------------------
# --- determine version (arg > metadata.json) --------------------------------
if [ "${1:-}" != "" ]; then
VERSION="$1"
elif command -v jq >/dev/null 2>&1 && [ -f metadata.json ]; then
VERSION="$(jq -r '.version' metadata.json)"
else
echo "ERROR: nincs verzió (adj meg argumentumot, vagy telepíts jq-t a metadata.json olvasásához)" >&2
echo "ERROR: no version (pass an argument, or install jq to read metadata.json)" >&2
exit 1
fi
echo "==> Verzió: $VERSION"
echo "==> Version: $VERSION"
ZIP_NAME="$PROJECT-$VERSION.html.zip"
META_DST="$PROJECT-$VERSION.metadata.json"
@@ -37,36 +37,36 @@ mkdir -p "$DIST_DIR"
echo "==> WASM build ($WASM_NAME)"
GOOS=js GOARCH=wasm go build -o "$DIST_DIR/$WASM_NAME" .
# --- wasm_exec.js a Go disztribúcióból --------------------------------------
echo "==> wasm_exec.js másolása"
# --- wasm_exec.js from the Go distribution ----------------------------------
echo "==> copying wasm_exec.js"
GOROOT="$(go env GOROOT)"
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
cp "$GOROOT/lib/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
cp "$GOROOT/misc/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
else
echo "ERROR: wasm_exec.js nem található a GOROOT alatt ($GOROOT)" >&2
echo "ERROR: wasm_exec.js not found under GOROOT ($GOROOT)" >&2
exit 1
fi
# --- index.html letöltése ---------------------------------------------------
echo "==> index.html letöltése"
# --- download index.html ----------------------------------------------------
echo "==> downloading index.html"
curl -sSL "$INDEX_HTML_URL" -o "$DIST_DIR/index.html"
# --- csomagolás (lapos zip, mint a Makefile -j) -----------------------------
echo "==> Csomagolás: $DIST_DIR/$ZIP_NAME"
# --- package (flat zip, like Makefile -j) -----------------------------------
echo "==> packaging: $DIST_DIR/$ZIP_NAME"
zip -j -r "$DIST_DIR/$ZIP_NAME" \
"$DIST_DIR/$WASM_NAME" \
"$DIST_DIR/wasm_exec.js" \
"$DIST_DIR/index.html" >/dev/null
# --- metadata.json a feltöltési névvel --------------------------------------
# --- metadata.json with the upload name -------------------------------------
echo "==> metadata.json -> $DIST_DIR/$META_DST"
cp metadata.json "$DIST_DIR/$META_DST"
# --- ideiglenes fájlok takarítása (a zip már tartalmazza őket) ---------------
# --- clean up intermediate files (the zip already contains them) ------------
rm -f "$DIST_DIR/$WASM_NAME" "$DIST_DIR/wasm_exec.js" "$DIST_DIR/index.html"
echo ""
echo "==> Kész. Feltöltésre kész artifactok a(z) $DIST_DIR/ mappában:"
echo "==> Done. Upload-ready artifacts in the $DIST_DIR/ folder:"
ls -la "$DIST_DIR"
+1 -1
View File
@@ -5,5 +5,5 @@
"desc": "Jump and roll your way through the world as a cute rabbit in this endless runner game.",
"site": "https://git.teletype.hu/games/rabbitroller",
"license": "MIT License",
"version": "1.0.0"
"version": "1.1.0"
}