mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-18 09:14:09 +00:00
Include Vite's bundle output in the manifest (#3772)
## Description: ## Summary Include Vite's bundle output (`vendor-*`, `index-*`, workers, CSS under `static/assets/`) in the asset manifest so the R2 deploy upload covers them alongside hashed source assets. Move the manifest from `static/_assets/asset-manifest.json` to `static/asset-manifest.json` since it now describes both trees, and update `update.sh` to extract the whole `static/` tree. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
This commit is contained in:
@@ -53,18 +53,19 @@ EXTRACT_DIR="$(mktemp -d -t openfront-assets-XXXXXX)"
|
||||
trap 'rm -rf "$EXTRACT_DIR"' EXIT
|
||||
|
||||
TMP_CONTAINER="$(docker create "${GHCR_IMAGE}")"
|
||||
if ! docker cp "${TMP_CONTAINER}:/usr/src/app/static/_assets" "$EXTRACT_DIR/"; then
|
||||
if ! docker cp "${TMP_CONTAINER}:/usr/src/app/static" "$EXTRACT_DIR/"; then
|
||||
echo "❌ docker cp failed"
|
||||
docker rm "${TMP_CONTAINER}" > /dev/null 2>&1 || true
|
||||
exit 1
|
||||
fi
|
||||
docker rm "${TMP_CONTAINER}" > /dev/null
|
||||
|
||||
echo "Extracted to $EXTRACT_DIR; top-level contents:"
|
||||
ls -la "$EXTRACT_DIR/" || true
|
||||
STATIC_DIR="$EXTRACT_DIR/static"
|
||||
echo "Extracted to $STATIC_DIR; top-level contents:"
|
||||
ls -la "$STATIC_DIR/" || true
|
||||
|
||||
R2_ENDPOINT="https://api.${DOMAIN}"
|
||||
MANIFEST="$EXTRACT_DIR/_assets/asset-manifest.json"
|
||||
MANIFEST="$STATIC_DIR/asset-manifest.json"
|
||||
if [ ! -f "$MANIFEST" ]; then
|
||||
echo "❌ Manifest not found at $MANIFEST"
|
||||
exit 1
|
||||
@@ -101,7 +102,7 @@ if [ -z "$MISSING" ]; then
|
||||
else
|
||||
MISSING_COUNT="$(echo "$MISSING" | wc -l | tr -d ' ')"
|
||||
echo "Uploading $MISSING_COUNT missing asset(s)..."
|
||||
export R2_ENDPOINT API_KEY EXTRACT_DIR
|
||||
export R2_ENDPOINT API_KEY STATIC_DIR
|
||||
# KEY from the manifest is URL-encoded per segment (e.g. flags/C%C3%B4te.png).
|
||||
# Files on disk live at the *decoded* path, so decode KEY before reading the
|
||||
# file, then encode the whole decoded path as one URL segment for the POST.
|
||||
@@ -132,7 +133,7 @@ else
|
||||
"$R2_ENDPOINT/game_assets/upload/$ENC" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$EXTRACT_DIR/$DECODED" > /dev/null; then
|
||||
--data-binary "@$STATIC_DIR/$DECODED" > /dev/null; then
|
||||
echo "❌ Failed to upload: $DECODED" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user