This commit is contained in:
2026-02-08 03:23:19 +01:00
parent 440ac6b195
commit 542186030f

View File

@@ -64,7 +64,7 @@ jobs:
- name: Process Archives - name: Process Archives
run: | run: |
# 1. Define Paths # Define Paths
SOURCE_ROOT="./cars" SOURCE_ROOT="./cars"
# This is where the server expects the files # This is where the server expects the files
DEST_ROOT="./server-data/content/cars" DEST_ROOT="./server-data/content/cars"
@@ -72,54 +72,49 @@ jobs:
echo "Searching for archives in $SOURCE_ROOT..." echo "Searching for archives in $SOURCE_ROOT..."
# 2. Find all archives recursively (zip, 7z, rar) # Find all archives recursively (zip, 7z, rar)
find "$SOURCE_ROOT" -type f \( -name "*.zip" -o -name "*.7z" -o -name "*.rar" \) | while read archive; do find "$SOURCE_ROOT" -type f \( -name "*.zip" -o -name "*.7z" -o -name "*.rar" \) | while read archive; do
# Get the filename without extension (e.g., "cars/groupA/my_car.zip" -> "my_car") # Get the filename without extension (e.g., "cars/groupA/my_car.zip" -> "my_car")
filename=$(basename -- "$archive") filename=$(basename -- "$archive")
car_name="${filename%.*}" car_name="${filename%.*}"
echo "--------------------------------------" echo "--------------------------------------"
echo "Processing: $car_name" echo "Processing: $car_name"
# Create a temp directory for extraction # Create a temp directory for extraction
temp_dir=$(mktemp -d) temp_dir=$(mktemp -d)
# 3. Extract contents # Extract contents
# -y: assume yes on all queries 7z x "$archive" -o"$temp_dir" -y > /dev/null
# -o: output directory (no space after -o)
7z x "$archive" -o"$temp_dir" -y > /dev/null # FILTERING LOGIC
find "$temp_dir" -type f -not -name "skins/*/livery.png" \
-not -name "skins/*/preview.jpeg" \
-not -name "skins/*/ui_skin.json" \
-not -name "ui/badge.png" \
-not -name "ui/ui_car.json" \
-not -name "data.acd" \
-not -name "physics/standard/data.acd" \
-not -name "physics/csp/data.acd" \
-delete
# 4. FILTERING LOGIC tree "$temp_dir"
# remove skins that are not livery.png, preview.jpeg, or ui_skin.json # # 5. Move to final Server Directory
find "$temp_dir" -type f -not -name "skins/*/livery.png" \ # target_dir="$DEST_ROOT/$car_name"
-not -name "skins/*/preview.jpeg" \
-not -name "skins/*/ui_skin.json" \
-not -name "ui/badge.png" \
-not -name "ui/ui_car.json" \
-not -name "data.acd" \
-not -name "physics/standard/data.acd" \
-not -name "physics/csp/data.acd" \
-delete
tree "$temp_dir" # # Clean old version if exists
# if [ -d "$target_dir" ]; then
# rm -rf "$target_dir"
# fi
# mkdir -p "$target_dir"
# # 5. Move to final Server Directory # # Move files
# target_dir="$DEST_ROOT/$car_name" # cp -r "$temp_dir"/* "$target_dir"/
# # Clean old version if exists # # Cleanup temp
# if [ -d "$target_dir" ]; then # rm -rf "$temp_dir"
# rm -rf "$target_dir"
# fi
# mkdir -p "$target_dir"
# # Move files
# cp -r "$temp_dir"/* "$target_dir"/
# # Cleanup temp
# rm -rf "$temp_dir"
echo "✅ Installed to: $target_dir" echo "✅ Installed to: $target_dir"
done done