name: Extract Archives run-name: Extract Archives on: workflow_dispatch: push: branches: - master paths: - "cars/**" # Only run if archives in cars/ change env: GIT_DEFAULT_HASH: sha1 jobs: prepare-server-content: runs-on: ubuntu-latest steps: - name: Pre-initialize Repository with SHA-256 run: | mkdir -p ${{ github.workspace }} git init --object-format=sha256 ${{ github.workspace }} - name: Checkout Main Branch (No LFS) uses: actions/checkout@v4 with: ref: main lfs: false # <--- Turn this OFF fetch-depth: 1 clean: false - name: Manual LFS Fetch with Debugging env: GIT_TRACE: 1 GIT_TRANSFER_TRACE: 1 GIT_CURL_VERBOSE: 1 run: | git lfs install # Try to pull the specific missing files to see the real error message git lfs fetch origin main git lfs checkout # steps: # - name: Checkout Master Branch (LFS) # uses: actions/checkout@v4 # with: # ref: master # lfs: true # fetch-depth: 0 # - name: Install 7-Zip # run: | # sudo apt-get update # sudo apt-get install -y p7zip-full # - name: Process Archives # run: | # # 1. Define Paths # SOURCE_ROOT="./cars" # # This is where the server expects the files # DEST_ROOT="./server-data/content/cars" # mkdir -p "$DEST_ROOT" # echo "๐Ÿ” Searching for archives in $SOURCE_ROOT..." # # 2. Find all archives recursively (zip, 7z, rar) # 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") # filename=$(basename -- "$archive") # car_name="${filename%.*}" # echo "--------------------------------------" # echo "Processing: $car_name" # # # Create a temp directory for extraction # # temp_dir=$(mktemp -d) # # # 3. Extract contents # # # -y: assume yes on all queries # # # -o: output directory (no space after -o) # # 7z x "$archive" -o"$temp_dir" -y > /dev/null # # # 4. FILTERING LOGIC (The "Server" optimization) # # echo "Cleaning up unnecessary server files..." # # # Remove heavy textures and previews (recursive) # # find "$temp_dir" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.dds" -o -name "*.kn5" -o -name "*.bmp" \) -delete # # # Remove the 'physics/csp' folder if standard physics are preferred (Optional - comment out if needed) # # # rm -rf "$temp_dir/physics/csp" # # # 5. Move to final Server Directory # # target_dir="$DEST_ROOT/$car_name" # # # Clean old version if exists # # if [ -d "$target_dir" ]; then # # 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" # done # - name: Verify Installation # run: | # echo "๐Ÿ“Final Server Directory Structure:" # # Show directory tree 3 levels deep to verify structure without spamming files # find ./server-data -maxdepth 3 -not -path '*/.*'