Update .gitea/actions/generate-docs/action.yml

This commit is contained in:
Arlind
2025-10-03 21:29:35 +02:00
parent c1a5162536
commit b10f1fe7d6

View File

@@ -11,6 +11,10 @@ inputs:
doc_dir:
description: "Directory to write per-skin markdown pages"
required: true
user_repository:
description: "Path of the repository (relative inside container)"
required: true
runs:
using: "composite"
@@ -88,7 +92,7 @@ runs:
raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')"
base_path=$(url_encode_path "$raw_path")
echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
echo "## [$skin_header]($REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
echo "" >> "${{ inputs.readme_path }}"
desc=$(get_desc "$skin")
@@ -129,7 +133,7 @@ runs:
raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')"
base_path=$(url_encode_path "$raw_path")
echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
echo "## [$skin_header]($REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk)" >> "${{ inputs.readme_path }}"
echo "" >> "${{ inputs.readme_path }}"
if [ -f "$ini_file" ]; then
@@ -150,14 +154,14 @@ runs:
echo "| ------- | ---- |" >> "${{ inputs.readme_path }}"
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/$USER_REPOSITORY/src/tag/${{ inputs.new_tag }}/README.md) | $current_commit_date |" >> "${{ inputs.readme_path }}"
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/${{ inputs.new_tag }}/README.md) | $current_commit_date |" >> "${{ inputs.readme_path }}"
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ inputs.new_tag }}$" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)
if [ -n "$old_tags" ]; then
echo "$old_tags" | while read -r tag; do
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/$USER_REPOSITORY/src/tag/$tag/README.md) | $formatted_date |" >> "${{ inputs.readme_path }}"
echo "| [\`$tag\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/$tag/README.md) | $formatted_date |" >> "${{ inputs.readme_path }}"
done
fi
@@ -209,12 +213,12 @@ runs:
raw_path="${skin}/${skin_header}"
base_path=$(url_encode_path "$raw_path")
osk_url="$REGISTRY_URL/$USER_REPOSITORY/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk"
osk_url="$REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/export/${base_path}.osk"
md_file_path="${{ inputs.doc_dir }}/${raw_path}.md"
mkdir -p "$(dirname "$md_file_path")"
video_url="$REGISTRY_URL/$USER_REPOSITORY/media/tag/${{ inputs.new_tag }}/media/gameplay/${base_path}.mp4"
video_url="$REGISTRY_URL/${{ inputs.user_repository }}/media/tag/${{ inputs.new_tag }}/media/gameplay/${base_path}.mp4"
author=""
if [ -f "$ini_file" ]; then
@@ -249,7 +253,7 @@ runs:
echo "| ------- | ---- |"
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/$USER_REPOSITORY/src/tag/${{ inputs.new_tag }}/docs/${base_path}.md) | $current_commit_date |"
echo "| [\`${{ inputs.new_tag }} (Current)\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/${{ inputs.new_tag }}/docs/${base_path}.md) | $current_commit_date |"
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ inputs.new_tag }}$" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)
if [ -n "$old_tags" ]; then
@@ -258,7 +262,7 @@ runs:
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/$USER_REPOSITORY/src/tag/$tag/docs/${base_path}.md) | $formatted_date |"
echo "| [\`$tag\`]($REGISTRY_URL/${{ inputs.user_repository }}/src/tag/$tag/docs/${base_path}.md) | $formatted_date |"
fi
done
fi