diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 165f334b..6d4d532f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -730,6 +730,9 @@ jobs: - name: Generate Per-Skin Pages shell: bash run: | + set -euo pipefail + set -x # Print each command before executing it + echo "Generating detailed per-skin markdown pages…" sanitize_filename() { @@ -750,36 +753,48 @@ jobs: echo "$encoded" } + echo "Checking DOC_DIR: $DOC_DIR" mkdir -p "$DOC_DIR" + echo "Processing skins in directory: $DANSER_SKINS_DIR" for dir in "$DANSER_SKINS_DIR"/*; do - [ -d "$dir" ] || continue + echo "Examining $dir" + [ -d "$dir" ] || { echo "Skipping non-directory $dir"; continue; } + skin=$(basename "$dir") - ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1) + ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1 || true) skin_header="$skin" + echo "Found skin: $skin" if [ -f "$ini_file" ]; then - line=$(grep -i '^[[:space:]]*Name:' "$ini_file" | head -n1) - [ -n "$line" ] && skin_header=$(sanitize_filename "${line#*:}") + echo "Found ini file: $ini_file" + line=$(grep -i '^[[:space:]]*Name:' "$ini_file" | head -n1 || true) + if [ -n "$line" ]; then + skin_header=$(sanitize_filename "${line#*:}") + fi fi + echo "Skin header: $skin_header" + raw_path="${skin}/${skin_header}" base_path=$(url_encode_path "$raw_path") osk_url="$REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/${base_path}.osk" - md_file_path="${DOC_DIR}/${raw_path}.md" - mkdir -p "$(dirname "$md_file_path")" + + mkdir -p "$(dirname "$md_file_path")" || { echo "Failed to create directory for $md_file_path"; exit 1; } video_url="$REGISTRY_URL/$USER_REPOSITORY/raw/tag/$new_tag/media/gameplay/${base_path}.mp4" - echo "# [$skin_header]($osk_url)" > "$md_file_path" - echo "" >> "$md_file_path" - echo "" >> "$md_file_path" - echo "" >> "$md_file_path" - echo "![](/media/panel/${base_path}.webp)" >> "$md_file_path" - echo "" >> "$md_file_path" - echo "![](/media/icons/${base_path}-mod-icons.webp)" >> "$md_file_path" + { + echo "# [$skin_header]($osk_url)" + echo "" + echo "" + echo "" + echo "![](/media/panel/${base_path}.webp)" + echo "" + echo "![](/media/icons/${base_path}-mod-icons.webp)" + } > "$md_file_path" echo " → Wrote $md_file_path" done