feat(deploy): retrieve Falukant models from Git LFS
Some checks failed
Deploy to production / deploy (push) Failing after 1m27s
Some checks failed
Deploy to production / deploy (push) Failing after 1m27s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Versioned Falukant source-model release. Keep both values together when
|
||||
# publishing a new release attachment.
|
||||
FALUKANT_MODELS_URL=https://git.tsschulz.de/torsten/yourpart3-assets/releases/download/falukant-models-v1/falukant-models-v1.tar.gz
|
||||
FALUKANT_MODELS_SHA256=b7e4c168c3e3fb3b17d73e142472da13b7084e01cccdea24add087c7991f1fe2
|
||||
# Versioned Falukant source models. Deployments clone this Git-LFS repository
|
||||
# and build the optimized files locally.
|
||||
FALUKANT_MODELS_REPOSITORY=ssh://git@tsschulz.de:2222/torsten/yourpart3-assets.git
|
||||
FALUKANT_MODELS_REF=main
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Voraussetzung: npm install (@gltf-transform/cli als Dev-Dep)
|
||||
*
|
||||
* Aufruf: npm run optimize-models
|
||||
* Optional können MODEL_SOURCE_DIR und MODEL_OUTPUT_DIR gesetzt werden, um
|
||||
* Modelle aus dem separaten YourPart3Assets-Repository zu verarbeiten.
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
@@ -13,8 +15,10 @@ import { fileURLToPath } from 'url';
|
||||
import path from 'path';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const sourceDir = path.join(__dirname, '..', 'models-src', '3d', 'falukant', 'characters');
|
||||
const outputDir = path.join(__dirname, '..', 'public', 'models', '3d', 'falukant', 'characters');
|
||||
const defaultSourceDir = path.join(__dirname, '..', 'models-src', '3d', 'falukant', 'characters');
|
||||
const defaultOutputDir = path.join(__dirname, '..', 'public', 'models', '3d', 'falukant', 'characters');
|
||||
const sourceDir = path.resolve(process.env.MODEL_SOURCE_DIR || defaultSourceDir);
|
||||
const outputDir = path.resolve(process.env.MODEL_OUTPUT_DIR || defaultOutputDir);
|
||||
const cli = path.join(__dirname, '..', 'node_modules', '.bin', 'gltf-transform');
|
||||
|
||||
function listSourceModels() {
|
||||
|
||||
@@ -60,24 +60,37 @@ if [ ! -f "$MODELS_MANIFEST" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source GLBs are versioned as a Gitea release attachment rather than Git
|
||||
# objects, keeping routine clones and deployments small.
|
||||
# Source GLBs are versioned in their own Git-LFS repository. Keep them outside
|
||||
# the application worktree, because update.sh removes untracked files there.
|
||||
# shellcheck disable=SC1090
|
||||
source "$MODELS_MANIFEST"
|
||||
: "${FALUKANT_MODELS_URL:?Falukant model URL is missing}"
|
||||
: "${FALUKANT_MODELS_SHA256:?Falukant model checksum is missing}"
|
||||
: "${FALUKANT_MODELS_REPOSITORY:?Falukant models repository is missing}"
|
||||
: "${FALUKANT_MODELS_REF:?Falukant models ref is missing}"
|
||||
|
||||
MODELS_ARCHIVE="$(mktemp /tmp/falukant-models-XXXXXX.tar.gz)"
|
||||
trap 'rm -f "$TEMP_ENV" "$MODELS_ARCHIVE"' EXIT
|
||||
ASSETS_DIR="$TARGET_DIR/.yourpart-assets"
|
||||
trap 'rm -f "$TEMP_ENV"' EXIT
|
||||
|
||||
echo "Lade Falukant-3D-Modelle (${FALUKANT_MODELS_URL})..."
|
||||
curl --fail --location --retry 3 --retry-delay 2 \
|
||||
--output "$MODELS_ARCHIVE" "$FALUKANT_MODELS_URL"
|
||||
echo "${FALUKANT_MODELS_SHA256} ${MODELS_ARCHIVE}" | sha256sum --check --status
|
||||
if ! git lfs version >/dev/null 2>&1; then
|
||||
echo "ERROR: git-lfs is required to retrieve Falukant models" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Entpacke Falukant-3D-Modelle..."
|
||||
echo "Lade Falukant-3D-Modelle aus ${FALUKANT_MODELS_REPOSITORY}@${FALUKANT_MODELS_REF}..."
|
||||
rm -rf "$ASSETS_DIR"
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 --branch "$FALUKANT_MODELS_REF" \
|
||||
"$FALUKANT_MODELS_REPOSITORY" "$ASSETS_DIR"
|
||||
git -C "$ASSETS_DIR" lfs pull
|
||||
|
||||
ASSET_MODELS_DIR="$ASSETS_DIR/models-src/3d/falukant"
|
||||
if [ ! -d "$ASSET_MODELS_DIR/characters" ]; then
|
||||
echo "ERROR: Falukant models are missing from ${FALUKANT_MODELS_REPOSITORY}@${FALUKANT_MODELS_REF}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Übernehme Falukant-3D-Quellmodelle..."
|
||||
rm -rf "$FRONTEND_DIR/models-src/3d/falukant"
|
||||
tar -xzf "$MODELS_ARCHIVE" -C "$TARGET_DIR"
|
||||
mkdir -p "$FRONTEND_DIR/models-src/3d"
|
||||
cp -a "$ASSET_MODELS_DIR" "$FRONTEND_DIR/models-src/3d/"
|
||||
|
||||
echo "Optimiere Falukant-3D-Modelle..."
|
||||
npm run optimize-models
|
||||
|
||||
Reference in New Issue
Block a user