v1.1
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# build.sh — egy lépésben előállítja a dist/ mappába mindazt, amit a Makefile
|
# build.sh — produces in a single step everything in the dist/ folder that the
|
||||||
# (export + ci-upload) felscp-zne: a HTML/WASM zip-et és a metadata.json-t.
|
# Makefile (export + ci-upload) would scp up: the HTML/WASM zip and the
|
||||||
# Magát a feltöltést NEM végzi el.
|
# metadata.json. It does NOT perform the upload itself.
|
||||||
#
|
#
|
||||||
# ./build.sh # verzió a metadata.json-ból (1.0.0)
|
# ./build.sh # version from metadata.json (1.0.0)
|
||||||
# ./build.sh 1.2.3 # verzió felülírása argumentummal
|
# ./build.sh 1.2.3 # override version via argument
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -16,16 +16,16 @@ DIST_DIR="dist"
|
|||||||
WASM_NAME="game.wasm"
|
WASM_NAME="game.wasm"
|
||||||
INDEX_HTML_URL="https://git.teletype.hu/tools/ebitengine-tools/raw/branch/master/web/index.html"
|
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
|
if [ "${1:-}" != "" ]; then
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
elif command -v jq >/dev/null 2>&1 && [ -f metadata.json ]; then
|
elif command -v jq >/dev/null 2>&1 && [ -f metadata.json ]; then
|
||||||
VERSION="$(jq -r '.version' metadata.json)"
|
VERSION="$(jq -r '.version' metadata.json)"
|
||||||
else
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "==> Verzió: $VERSION"
|
echo "==> Version: $VERSION"
|
||||||
|
|
||||||
ZIP_NAME="$PROJECT-$VERSION.html.zip"
|
ZIP_NAME="$PROJECT-$VERSION.html.zip"
|
||||||
META_DST="$PROJECT-$VERSION.metadata.json"
|
META_DST="$PROJECT-$VERSION.metadata.json"
|
||||||
@@ -37,36 +37,36 @@ mkdir -p "$DIST_DIR"
|
|||||||
echo "==> WASM build ($WASM_NAME)"
|
echo "==> WASM build ($WASM_NAME)"
|
||||||
GOOS=js GOARCH=wasm go build -o "$DIST_DIR/$WASM_NAME" .
|
GOOS=js GOARCH=wasm go build -o "$DIST_DIR/$WASM_NAME" .
|
||||||
|
|
||||||
# --- wasm_exec.js a Go disztribúcióból --------------------------------------
|
# --- wasm_exec.js from the Go distribution ----------------------------------
|
||||||
echo "==> wasm_exec.js másolása"
|
echo "==> copying wasm_exec.js"
|
||||||
GOROOT="$(go env GOROOT)"
|
GOROOT="$(go env GOROOT)"
|
||||||
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
|
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
|
||||||
cp "$GOROOT/lib/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
|
cp "$GOROOT/lib/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
|
||||||
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
|
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
|
||||||
cp "$GOROOT/misc/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
|
cp "$GOROOT/misc/wasm/wasm_exec.js" "$DIST_DIR/wasm_exec.js"
|
||||||
else
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- index.html letöltése ---------------------------------------------------
|
# --- download index.html ----------------------------------------------------
|
||||||
echo "==> index.html letöltése"
|
echo "==> downloading index.html"
|
||||||
curl -sSL "$INDEX_HTML_URL" -o "$DIST_DIR/index.html"
|
curl -sSL "$INDEX_HTML_URL" -o "$DIST_DIR/index.html"
|
||||||
|
|
||||||
# --- csomagolás (lapos zip, mint a Makefile -j) -----------------------------
|
# --- package (flat zip, like Makefile -j) -----------------------------------
|
||||||
echo "==> Csomagolás: $DIST_DIR/$ZIP_NAME"
|
echo "==> packaging: $DIST_DIR/$ZIP_NAME"
|
||||||
zip -j -r "$DIST_DIR/$ZIP_NAME" \
|
zip -j -r "$DIST_DIR/$ZIP_NAME" \
|
||||||
"$DIST_DIR/$WASM_NAME" \
|
"$DIST_DIR/$WASM_NAME" \
|
||||||
"$DIST_DIR/wasm_exec.js" \
|
"$DIST_DIR/wasm_exec.js" \
|
||||||
"$DIST_DIR/index.html" >/dev/null
|
"$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"
|
echo "==> metadata.json -> $DIST_DIR/$META_DST"
|
||||||
cp 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"
|
rm -f "$DIST_DIR/$WASM_NAME" "$DIST_DIR/wasm_exec.js" "$DIST_DIR/index.html"
|
||||||
|
|
||||||
echo ""
|
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"
|
ls -la "$DIST_DIR"
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@
|
|||||||
"desc": "Jump and roll your way through the world as a cute rabbit in this endless runner game.",
|
"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",
|
"site": "https://git.teletype.hu/games/rabbitroller",
|
||||||
"license": "MIT License",
|
"license": "MIT License",
|
||||||
"version": "1.0.0"
|
"version": "1.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user