Update .gitea/actions/generate-docs/action.yml
This commit is contained in:
@@ -1,275 +1,244 @@
|
|||||||
name: "Generate Documentation"
|
name: "Check Links"
|
||||||
description: "Generate README index and per-skin markdown pages"
|
description: "Check all links in markdown files for validity"
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
new_tag:
|
|
||||||
description: "The new tag for this build"
|
|
||||||
required: true
|
|
||||||
readme_path:
|
|
||||||
description: "Path to write README.md"
|
|
||||||
required: true
|
|
||||||
doc_dir:
|
|
||||||
description: "Directory to write per-skin markdown pages"
|
|
||||||
required: true
|
|
||||||
user_repository:
|
user_repository:
|
||||||
description: "Path of the repository (relative inside container)"
|
description: "Repository path in format owner/repo"
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Generate README
|
- name: Check all links in markdown files
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Generating README index…"
|
#!/bin/bash
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
sanitize_filename() {
|
echo "[Link Checker Job Started]"
|
||||||
echo "$1" | \
|
echo ""
|
||||||
tr -d '\000-\037' | \
|
|
||||||
sed -e 's#[\\/:\*\?"<>|]#-#g' | \
|
|
||||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
||||||
}
|
|
||||||
|
|
||||||
url_encode_path() {
|
# Find all markdown files
|
||||||
local IFS='/'
|
find . -name "*.md" -type f | sort > all_markdown_files.txt
|
||||||
local parts=($1)
|
total_files=$(wc -l < all_markdown_files.txt)
|
||||||
local encoded=""
|
echo "Found $total_files markdown files to check"
|
||||||
for part in "${parts[@]}"; do
|
echo ""
|
||||||
[ -n "$encoded" ] && encoded+="/"
|
|
||||||
encoded+=$(printf '%s' "$part" | jq -sRr @uri)
|
|
||||||
done
|
|
||||||
echo "$encoded"
|
|
||||||
}
|
|
||||||
|
|
||||||
SKINS_JSON_FILE="${{ github.workspace }}/.gitea/workflows/skins.json"
|
has_errors=0
|
||||||
DESC_FILE=$(mktemp)
|
file_index=1
|
||||||
|
|
||||||
echo "---" > "${{ inputs.readme_path }}"
|
# Process each markdown file
|
||||||
echo "gitea: none" >> "${{ inputs.readme_path }}"
|
while IFS= read -r md_file; do
|
||||||
echo "include_toc: true" >> "${{ inputs.readme_path }}"
|
echo "[$file_index/$total_files] Checking: $md_file"
|
||||||
echo "---" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "# Skins" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "<!--" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "osuid: $OSU_ID" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "-->" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "**Go back to [osc/skins]($REGISTRY_URL/osc/skins)**" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "**Click on the Skin name to download it, or click on the thumbnail to see more about the skin, including a video preview, screenshots, and mod icons.**" >> "${{ inputs.readme_path }}"
|
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
|
||||||
|
|
||||||
jq -r '.descriptions | to_entries[] | "\(.key)=\(.value)"' "$SKINS_JSON_FILE" > "$DESC_FILE"
|
file_has_errors=0
|
||||||
jq -r '.order[]?' "$SKINS_JSON_FILE" > order.txt
|
|
||||||
|
|
||||||
get_desc() {
|
# Extract ALL links from the markdown file
|
||||||
grep -F -m1 -- "$1=" "$DESC_FILE" 2>/dev/null | cut -d '=' -f2- || true
|
{
|
||||||
}
|
# Markdown links []()
|
||||||
|
grep -oP '\]\(([^\)]+)\)' "$md_file" 2>/dev/null | sed 's/](\(.*\))/\1/' || true
|
||||||
|
# Image links ![]()
|
||||||
|
grep -oP '!\[[^\]]*\]\(([^\)]+)\)' "$md_file" 2>/dev/null | sed 's/!\[.*\](\(.*\))/\1/' || true
|
||||||
|
# Video src attributes
|
||||||
|
grep -oP '<video[^>]+src="([^"]+)"' "$md_file" 2>/dev/null | sed 's/.*src="\([^"]*\)".*/\1/' || true
|
||||||
|
} > /tmp/links_$$.txt
|
||||||
|
|
||||||
declare -A ordered
|
link_count=$(wc -l < /tmp/links_$$.txt 2>/dev/null || echo "0")
|
||||||
while IFS= read -r skin; do
|
|
||||||
[ "$skin" = "default-skin" ] && continue
|
|
||||||
ordered["$skin"]=1
|
|
||||||
dir="$DANSER_SKINS_DIR/$skin"
|
|
||||||
[ ! -d "$dir" ] && continue
|
|
||||||
|
|
||||||
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
if [ $link_count -eq 0 ]; then
|
||||||
skin_header="$skin"
|
echo " → No links found"
|
||||||
|
echo ""
|
||||||
if [ -f "$ini_file" ]; then
|
file_index=$((file_index + 1))
|
||||||
name_line=$(grep -a -i -m1 'Name[[:space:]]*:' "$ini_file" || true)
|
|
||||||
if [ -n "$name_line" ]; then
|
|
||||||
val="${name_line#*:}"
|
|
||||||
val="$(echo "$val" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
||||||
[ -n "$val" ] && skin_header=$(sanitize_filename "$val")
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')"
|
echo " → Checking $link_count links..."
|
||||||
base_path=$(url_encode_path "$raw_path")
|
|
||||||
|
|
||||||
echo "## [$skin_header]($REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
|
# Categorize and check links
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
> /tmp/download_$$.txt
|
||||||
|
> /tmp/media_$$.txt
|
||||||
|
> /tmp/video_$$.txt
|
||||||
|
> /tmp/tags_$$.txt
|
||||||
|
|
||||||
desc=$(get_desc "$skin")
|
# Check each link
|
||||||
[ -n "$desc" ] && { echo "$desc" >> "${{ inputs.readme_path }}"; echo "" >> "${{ inputs.readme_path }}"; }
|
while IFS= read -r link; do
|
||||||
|
[ -z "$link" ] && continue
|
||||||
|
|
||||||
if [ -f "$ini_file" ]; then
|
# Decode URL-encoded characters for display
|
||||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n1 || true)
|
decoded_link=$(echo "$link" | sed 's/%20/ /g' | sed 's/%23/#/g' | sed 's/%28/(/g' | sed 's/%29/)/g' | sed 's/%E2%80%A2/•/g' | sed 's/%E1%9A%96/ᚖ/g' | sed 's/%E3%80%8A/《/g' | sed 's/%E3%80%8B/》/g' | sed 's/%E3%80%8E/『/g' | sed 's/%E3%80%8F/』/g' | sed 's/%E2%9B%94/⛔/g' | sed 's/%E2%9C%A8/✨/g' | sed 's/%7B/{/g' | sed 's/%7D/}/g' | sed 's/%2B/+/g' | sed 's/%E3%83%86/テ/g' | sed 's/%E3%83%B3/ン/g' | sed 's/%E3%83%8D/ネ/g' | sed 's/%E3%82%B9/ス/g' | sed 's/%E3%82%A4/イ/g' | sed 's/%E3%83%BB/・/g' | sed 's/%E3%83%95/フ/g' | sed 's/%E3%83%AA/リ/g' | sed 's/%E3%83%BC/ー/g' | sed 's/%E3%83%8A/ナ/g' | sed 's/%5B/[/g' | sed 's/%5D/]/g' | sed 's/%2C/,/g')
|
||||||
if [ -n "$author_line" ]; then
|
|
||||||
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
# Determine link category and validation status
|
||||||
[ -n "$author" ] && { echo "**Author:** $author" >> "${{ inputs.readme_path }}"; echo "" >> "${{ inputs.readme_path }}"; }
|
status="✓"
|
||||||
|
|
||||||
|
# Get repository info from input
|
||||||
|
if [ -z "$REPO_OWNER" ]; then
|
||||||
|
REPO_OWNER="${{ inputs.user_repository }}"
|
||||||
|
REPO_OWNER="${REPO_OWNER%/*}"
|
||||||
|
REPO_NAME="${{ inputs.user_repository }}"
|
||||||
|
REPO_NAME="${REPO_NAME#*/}"
|
||||||
|
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[](/docs/${base_path}.md)" >> "${{ inputs.readme_path }}"
|
# Check if it's an external URL
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
if [[ "$decoded_link" =~ ^https?:// ]]; then
|
||||||
done < order.txt
|
# Replace git.sulej.net with internal gitea URL for checking
|
||||||
|
check_url="$link"
|
||||||
|
if [[ "$link" =~ git\.sulej\.net ]]; then
|
||||||
|
check_url="${link//git.sulej.net/gitea:3000}"
|
||||||
|
check_url="${check_url//https:/http:}"
|
||||||
|
fi
|
||||||
|
|
||||||
for dir in "$DANSER_SKINS_DIR"/*; do
|
# Check external URL with curl
|
||||||
[ -d "$dir" ] || continue
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 \
|
||||||
skin="$(basename "$dir")"
|
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
|
||||||
[ "$skin" = "default-skin" ] && continue
|
"$check_url" 2>/dev/null || echo "000")
|
||||||
[[ -n "${ordered[$skin]}" ]] && continue
|
else
|
||||||
|
# Local file - convert to full Gitea URL (keep URL encoding)
|
||||||
|
if [[ "$link" =~ ^/ ]]; then
|
||||||
|
# Absolute path from repo root
|
||||||
|
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH${link}"
|
||||||
|
display_url="https://git.sulej.net/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH${link}"
|
||||||
|
else
|
||||||
|
# Relative path from markdown file
|
||||||
|
md_dir=$(dirname "$md_file")
|
||||||
|
if [[ "$md_dir" == "." ]]; then
|
||||||
|
rel_path="$link"
|
||||||
|
else
|
||||||
|
rel_path="${md_dir#./}/$link"
|
||||||
|
fi
|
||||||
|
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH/$rel_path"
|
||||||
|
display_url="https://git.sulej.net/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH/$rel_path"
|
||||||
|
fi
|
||||||
|
|
||||||
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
# Use display_url for output instead of decoded_link
|
||||||
skin_header="$skin"
|
decoded_link="$display_url"
|
||||||
|
|
||||||
if [ -f "$ini_file" ]; then
|
# Check URL with curl
|
||||||
name_line=$(grep -a -i -m1 'Name[[:space:]]*:' "$ini_file" || true)
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$check_url" 2>/dev/null || echo "000")
|
||||||
if [ -n "$name_line" ]; then
|
|
||||||
val="${name_line#*:}"
|
|
||||||
val="$(echo "$val" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
||||||
[ -n "$val" ] && skin_header=$(sanitize_filename "$val")
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')"
|
# Accept 2xx and 3xx status codes as valid
|
||||||
base_path=$(url_encode_path "$raw_path")
|
if ! [[ "$http_code" =~ ^[23][0-9][0-9]$ ]]; then
|
||||||
|
status="✖ (HTTP $http_code)"
|
||||||
echo "## [$skin_header]($REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
|
file_has_errors=1
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
has_errors=1
|
||||||
|
|
||||||
if [ -f "$ini_file" ]; then
|
|
||||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n1 || true)
|
|
||||||
if [ -n "$author_line" ]; then
|
|
||||||
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
||||||
[ -n "$author" ] && { echo "**Author:** $author" >> "${{ inputs.readme_path }}"; echo "" >> "${{ inputs.readme_path }}"; }
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[](/docs/${base_path}.md)" >> "${{ inputs.readme_path }}"
|
# Categorize all links
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
if [[ "$decoded_link" =~ /export/.*\.(osk|osz)$ ]] || [[ "$decoded_link" =~ ^https?:// && ! "$decoded_link" =~ /media/ && ! "$decoded_link" =~ /src/tag/ ]]; then
|
||||||
done
|
echo " $status $decoded_link" >> /tmp/download_$$.txt
|
||||||
|
elif [[ "$decoded_link" =~ /media/gameplay/.*\.(mp4|webm)$ ]]; then
|
||||||
|
echo " $status $decoded_link" >> /tmp/video_$$.txt
|
||||||
|
elif [[ "$decoded_link" =~ /src/tag/ ]]; then
|
||||||
|
echo " $status $decoded_link" >> /tmp/tags_$$.txt
|
||||||
|
elif [[ "$decoded_link" =~ \.(webp|png|jpg|jpeg)$ ]] || [[ "$decoded_link" =~ /media/(panel|icons|thumbnail)/ ]]; then
|
||||||
|
echo " $status $decoded_link" >> /tmp/media_$$.txt
|
||||||
|
elif [[ "$decoded_link" =~ \.md$ ]]; then
|
||||||
|
echo " $status $decoded_link" >> /tmp/tags_$$.txt
|
||||||
|
else
|
||||||
|
echo " $status $decoded_link" >> /tmp/download_$$.txt
|
||||||
|
fi
|
||||||
|
done < /tmp/links_$$.txt
|
||||||
|
|
||||||
echo "# Build History" >> "${{ inputs.readme_path }}"
|
# Display categorized results - special handling for README
|
||||||
echo "" >> "${{ inputs.readme_path }}"
|
if [[ "$md_file" == "./README.md" ]]; then
|
||||||
echo "| Version | Date |" >> "${{ inputs.readme_path }}"
|
# For README, group by skin name
|
||||||
echo "| ------- | ---- |" >> "${{ inputs.readme_path }}"
|
> /tmp/skins_$$.txt
|
||||||
|
|
||||||
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
|
# Extract unique skin names from download links and decode them
|
||||||
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/${{ inputs.new_tag }}/README.md) | $current_commit_date |" >> "${{ inputs.readme_path }}"
|
if [ -s /tmp/download_$$.txt ]; then
|
||||||
|
grep -oP 'export/[^/]+' /tmp/download_$$.txt | sed 's|export/||' | while read -r encoded_name; do
|
||||||
|
# Decode the skin name
|
||||||
|
echo "$encoded_name" | sed 's/%20/ /g' | sed 's/%23/#/g' | sed 's/%28/(/g' | sed 's/%29/)/g' | sed 's/%E2%80%A2/•/g' | sed 's/%E1%9A%96/ᚖ/g' | sed 's/%E3%80%8A/《/g' | sed 's/%E3%80%8B/》/g' | sed 's/%E3%80%8E/『/g' | sed 's/%E3%80%8F/』/g' | sed 's/%E2%9B%94/⛔/g' | sed 's/%E2%9C%A8/✨/g' | sed 's/%7B/{/g' | sed 's/%7D/}/g' | sed 's/%2B/+/g' | sed 's/%E3%83%86/テ/g' | sed 's/%E3%83%B3/ン/g' | sed 's/%E3%83%8D/ネ/g' | sed 's/%E3%82%B9/ス/g' | sed 's/%E3%82%A4/イ/g' | sed 's/%E3%83%BB/・/g' | sed 's/%E3%83%95/フ/g' | sed 's/%E3%83%AA/リ/g' | sed 's/%E3%83%BC/ー/g' | sed 's/%E3%83%8A/ナ/g' | sed 's/%5B/[/g' | sed 's/%5D/]/g' | sed 's/%2C/,/g'
|
||||||
|
done | sort -u > /tmp/skins_$$.txt || true
|
||||||
|
fi
|
||||||
|
|
||||||
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ inputs.new_tag }}$" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)
|
# Show general links first (not skin-specific)
|
||||||
if [ -n "$old_tags" ]; then
|
if [ -s /tmp/download_$$.txt ]; then
|
||||||
echo "$old_tags" | while read -r tag; do
|
general_downloads=$(grep -v '/export/.*\.osk' /tmp/download_$$.txt | sort -u || true)
|
||||||
tag_date=$(git log -1 --format=%ci "$tag")
|
if [ -n "$general_downloads" ]; then
|
||||||
formatted_date=$(TZ="Europe/Zurich" date -d "$tag_date" "+%d.%m.%Y %H:%M:%S")
|
echo " general:"
|
||||||
echo "| [\`$tag\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/$tag/README.md) | $formatted_date |" >> "${{ inputs.readme_path }}"
|
echo "$general_downloads"
|
||||||
done
|
echo ""
|
||||||
fi
|
|
||||||
|
|
||||||
echo "README index generated successfully."
|
|
||||||
|
|
||||||
- name: Generate Per-Skin Pages
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Generating detailed per-skin markdown pages…"
|
|
||||||
|
|
||||||
sanitize_filename() {
|
|
||||||
echo "$1" | \
|
|
||||||
tr -d '\000-\037' | \
|
|
||||||
sed -e 's#[\\/:\*\?"<>|]#-#g' | \
|
|
||||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
||||||
}
|
|
||||||
|
|
||||||
url_encode_path() {
|
|
||||||
local IFS='/'
|
|
||||||
local parts=($1)
|
|
||||||
local encoded=""
|
|
||||||
for part in "${parts[@]}"; do
|
|
||||||
[ -n "$encoded" ] && encoded+="/"
|
|
||||||
encoded+=$(printf '%s' "$part" | jq -sRr @uri)
|
|
||||||
done
|
|
||||||
echo "$encoded"
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdir -p "${{ inputs.doc_dir }}"
|
|
||||||
|
|
||||||
for dir in "$DANSER_SKINS_DIR"/*; do
|
|
||||||
[ -d "$dir" ] || continue
|
|
||||||
|
|
||||||
skin=$(basename "$dir")
|
|
||||||
[ "$skin" = "default-skin" ] && continue
|
|
||||||
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
|
||||||
skin_header="$skin"
|
|
||||||
|
|
||||||
if [ -f "$ini_file" ]; then
|
|
||||||
line=$(grep -i '^[[:space:]]*Name:' "$ini_file" | head -n1 || true)
|
|
||||||
if [ -n "$line" ]; then
|
|
||||||
val="${line#*:}"
|
|
||||||
val="$(echo "$val" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
||||||
if [ -n "$val" ]; then
|
|
||||||
skin_header=$(sanitize_filename "$val")
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
raw_path="${skin}/${skin_header}"
|
# Show each skin's links together
|
||||||
base_path=$(url_encode_path "$raw_path")
|
while IFS= read -r skin_name; do
|
||||||
osk_url="$REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk"
|
[ -z "$skin_name" ] && continue
|
||||||
md_file_path="${{ inputs.doc_dir }}/${raw_path}.md"
|
|
||||||
|
|
||||||
mkdir -p "$(dirname "$md_file_path")"
|
echo " skin: $skin_name"
|
||||||
|
|
||||||
video_url="$REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/media/gameplay/${base_path}.mp4"
|
# Download link
|
||||||
|
grep "/export/$skin_name/.*\.osk" /tmp/download_$$.txt 2>/dev/null | sort -u || true
|
||||||
|
|
||||||
author=""
|
# Thumbnail
|
||||||
if [ -f "$ini_file" ]; then
|
grep "thumbnail/$skin_name/" /tmp/media_$$.txt 2>/dev/null | sort -u || true
|
||||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n1 || true)
|
|
||||||
if [ -n "$author_line" ]; then
|
# Docs
|
||||||
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
grep "/docs/$skin_name/" /tmp/tags_$$.txt 2>/dev/null | sort -u || true
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
done < /tmp/skins_$$.txt
|
||||||
|
|
||||||
|
# Show version tags separately
|
||||||
|
if [ -s /tmp/tags_$$.txt ]; then
|
||||||
|
version_tags=$(grep '/src/tag/' /tmp/tags_$$.txt | sort -u || true)
|
||||||
|
if [ -n "$version_tags" ]; then
|
||||||
|
echo " version tags:"
|
||||||
|
echo "$version_tags"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f /tmp/skins_$$.txt
|
||||||
|
else
|
||||||
|
# For other markdown files, show categorized as before
|
||||||
|
if [ -s /tmp/download_$$.txt ]; then
|
||||||
|
echo " download:"
|
||||||
|
sort -u /tmp/download_$$.txt
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -s /tmp/media_$$.txt ]; then
|
||||||
|
echo " media:"
|
||||||
|
sort -u /tmp/media_$$.txt
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -s /tmp/video_$$.txt ]; then
|
||||||
|
echo " video:"
|
||||||
|
sort -u /tmp/video_$$.txt
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -s /tmp/tags_$$.txt ]; then
|
||||||
|
echo " tags:"
|
||||||
|
sort -u /tmp/tags_$$.txt
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
rm -f /tmp/download_$$.txt /tmp/media_$$.txt /tmp/video_$$.txt /tmp/tags_$$.txt
|
||||||
echo "# [$skin_header]($osk_url)"
|
|
||||||
echo ""
|
|
||||||
[ -n "$author" ] && echo "**Author:** $author"
|
|
||||||
[ -n "$author" ] && echo ""
|
|
||||||
|
|
||||||
echo "## Hitsounds"
|
rm -f /tmp/links_$$.txt
|
||||||
echo "<video controls autoplay loop muted playsinline src=\"$video_url\" type=\"video/mp4\">"
|
|
||||||
echo "</video>"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "## Ranking Panel"
|
if [ $file_has_errors -eq 0 ]; then
|
||||||
echo ""
|
echo " ✓ All links valid"
|
||||||
echo ""
|
else
|
||||||
|
echo " ✖ Some links broken"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
echo "## Mod Icons"
|
file_index=$((file_index + 1))
|
||||||
echo ""
|
done < all_markdown_files.txt
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Build History"
|
|
||||||
echo ""
|
|
||||||
echo "| Version | Date |"
|
|
||||||
echo "| ------- | ---- |"
|
|
||||||
|
|
||||||
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
|
if [ $has_errors -eq 0 ]; then
|
||||||
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/${{ inputs.new_tag }}/docs/${base_path}.md) | $current_commit_date |"
|
echo "[Link Checker Complete — all links valid in $total_files files]"
|
||||||
|
exit 0
|
||||||
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ inputs.new_tag }}$" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)
|
else
|
||||||
if [ -n "$old_tags" ]; then
|
echo "[Link Checker Complete — found broken links in $total_files files]"
|
||||||
echo "$old_tags" | while read -r tag; do
|
exit 1
|
||||||
raw_osk_path="export/${skin}/${skin_header}.osk"
|
fi
|
||||||
if git ls-tree -r --name-only "$tag" | grep -Fx -- "$raw_osk_path" >/dev/null; then
|
|
||||||
tag_date=$(git log -1 --format=%ci "$tag")
|
|
||||||
formatted_date=$(TZ="Europe/Zurich" date -d "$tag_date" "+%d.%m.%Y %H:%M:%S")
|
|
||||||
echo "| [\`$tag\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/$tag/docs/${base_path}.md) | $formatted_date |"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
} > "$md_file_path"
|
|
||||||
|
|
||||||
echo " → Wrote $md_file_path"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Per-skin markdown pages complete."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user