Update .gitea/workflows/ci.yml
This commit is contained in:
@@ -603,7 +603,7 @@ jobs:
|
||||
SKINS_JSON_FILE="${{ github.workspace }}/.gitea/workflows/skins.json"
|
||||
DESC_FILE=$(mktemp)
|
||||
|
||||
echo "Step 1: Extracting descriptions from skins.json..."
|
||||
echo "Step 1: Extracting descriptions..."
|
||||
jq -r '.descriptions | to_entries[] | "\(.key)=\(.value)"' "$SKINS_JSON_FILE" > "$DESC_FILE"
|
||||
|
||||
echo "Step 2: Starting to build README..."
|
||||
@@ -621,178 +621,109 @@ jobs:
|
||||
echo "**Go back to [osc/skins](https://git.sulejmani.xyz/osc/skins)**" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
|
||||
get_desc() {
|
||||
key=$1
|
||||
grep -- "^${key}=" "$DESC_FILE" 2>/dev/null | cut -d '=' -f2-
|
||||
}
|
||||
get_desc() { grep -- "^$1=" "$DESC_FILE" 2>/dev/null | cut -d '=' -f2-; }
|
||||
|
||||
ORDER_FILE=$(mktemp)
|
||||
JSON_SKINS_TMP=$(mktemp)
|
||||
SEEN_HEADERS_FILE=$(mktemp)
|
||||
|
||||
echo "Step 3: Extracting order from skins.json..."
|
||||
echo "Step 3: Reading order..."
|
||||
jq -r '.order[]' "$SKINS_JSON_FILE" > "$ORDER_FILE"
|
||||
cp "$ORDER_FILE" "$JSON_SKINS_TMP"
|
||||
|
||||
echo "Step 4: Processing ordered skins..."
|
||||
echo "Step 4: Rendering ordered skins..."
|
||||
while IFS= read -r skin; do
|
||||
echo " Processing skin (order): $skin"
|
||||
dir="$DANSER_SKINS_DIR/$skin"
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo " Skipping missing directory: $dir"
|
||||
continue
|
||||
fi
|
||||
[ ! -d "$dir" ] && continue
|
||||
|
||||
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n 1 || true)
|
||||
skin_header="$skin"
|
||||
if [ -f "$ini_file" ]; then
|
||||
name_line=$(grep -i '^[[:space:]]*name:' "$ini_file" | head -n 1 || true)
|
||||
if [ -n "${name_line:-}" ]; then
|
||||
new_name=$(echo "$name_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//')
|
||||
new_name=$(sanitize_filename "$new_name")
|
||||
[ -n "$new_name" ] && skin_header="$new_name"
|
||||
ini="$dir/skin.ini"
|
||||
header="$skin"
|
||||
if [ -f "$ini" ]; then
|
||||
name_line=$(grep -i '^[[:space:]]*Name:' "$ini" | head -n1)
|
||||
if [ -n "$name_line" ]; then
|
||||
val="${name_line#*:}"
|
||||
header="$(sanitize_filename "${val#"${val%%[![:space:]]*}"}")"
|
||||
fi
|
||||
fi
|
||||
|
||||
skin_header=$(printf '%s' "$skin_header" | tr -d '\r\n' | sed -e 's/[[:space:]]*$//')
|
||||
base="$(printf "%s/%s" "$skin" "$header" | sed 's/ /%20/g')"
|
||||
img="${base}.gif"
|
||||
panel="${base}.png"
|
||||
osk="${base}.osk"
|
||||
mod="${base}-mod-icons.png"
|
||||
|
||||
if grep -F -x -q -- "$skin_header" "$SEEN_HEADERS_FILE"; then
|
||||
echo " Already seen skin header: $skin_header"
|
||||
continue
|
||||
fi
|
||||
echo "$skin_header" >> "$SEEN_HEADERS_FILE"
|
||||
|
||||
escaped_img=$(printf "%s" "$skin_header.gif" | sed 's/ /%20/g')
|
||||
escaped_osk=$(printf "%s" "$skin_header.osk" | sed 's/ /%20/g')
|
||||
|
||||
echo " Writing skin: $skin_header"
|
||||
echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/$escaped_osk)" >> "$README_PATH"
|
||||
echo "## [$header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/$osk)" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
|
||||
skin_desc=$(get_desc "$skin")
|
||||
if [ -n "$skin_desc" ]; then
|
||||
echo "$skin_desc" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
desc=$(get_desc "$skin")
|
||||
[ -n "$desc" ] && { echo "$desc" >> "$README_PATH"; echo "" >> "$README_PATH"; }
|
||||
|
||||
if [ -f "$ini_file" ]; then
|
||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n 1 || true)
|
||||
if [ -n "${author_line:-}" ]; then
|
||||
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||
if [ -n "$author" ]; then
|
||||
echo "**Author:** $author" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
if [ -f "$ini" ]; then
|
||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini" | head -n1)
|
||||
if [ -n "$author_line" ]; then
|
||||
auth="${author_line#*:}"
|
||||
auth="${auth#"${auth%%[![:space:]]*}"}"
|
||||
[ -n "$auth" ] && { echo "**Author:** $auth" >> "$README_PATH"; echo "" >> "$README_PATH"; }
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
|
||||
if [ -f "media/panel/${skin_header}.png" ]; then
|
||||
escaped_panel=$(printf "%s" "${skin_header}.png" | sed 's/ /%20/g')
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
|
||||
mod_icon_file="${skin_header}-mod-icons.png"
|
||||
if [ -f "media/icons/$mod_icon_file" ]; then
|
||||
escaped_mod=$(printf "%s" "$mod_icon_file" | sed 's/ /%20/g')
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
done < "$ORDER_FILE"
|
||||
|
||||
echo "Step 5: Processing extra skins..."
|
||||
echo "Step 5: Rendering extra skins..."
|
||||
find "$DANSER_SKINS_DIR" -mindepth 1 -maxdepth 1 -type d | while IFS= read -r dir; do
|
||||
skin=$(basename "$dir")
|
||||
echo " Processing extra skin: $skin"
|
||||
grep -qx "$skin" "$ORDER_FILE" && continue
|
||||
|
||||
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n 1 || true)
|
||||
skin_header="$skin"
|
||||
if [ -f "$ini_file" ]; then
|
||||
name_line=$(grep -i '^[[:space:]]*name:' "$ini_file" | head -n 1 || true)
|
||||
if [ -n "${name_line:-}" ]; then
|
||||
new_name=$(echo "$name_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//')
|
||||
new_name=$(sanitize_filename "$new_name")
|
||||
[ -n "$new_name" ] && skin_header="$new_name"
|
||||
ini="$dir/skin.ini"
|
||||
header="$skin"
|
||||
if [ -f "$ini" ]; then
|
||||
name_line=$(grep -i '^[[:space:]]*Name:' "$ini" | head -n1)
|
||||
if [ -n "$name_line" ]; then
|
||||
val="${name_line#*:}"
|
||||
header="$(sanitize_filename "${val#"${val%%[![:space:]]*}"}")"
|
||||
fi
|
||||
fi
|
||||
|
||||
skin_header=$(printf '%s' "$skin_header" | tr -d '\r\n' | sed -e 's/[[:space:]]*$//')
|
||||
base="$(printf "%s/%s" "$skin" "$header" | sed 's/ /%20/g')"
|
||||
img="${base}.gif"
|
||||
panel="${base}.png"
|
||||
osk="${base}.osk"
|
||||
mod="${base}-mod-icons.png"
|
||||
|
||||
if grep -F -x -q -- "$skin_header" "$SEEN_HEADERS_FILE"; then
|
||||
echo " Already seen (extra): $skin_header"
|
||||
continue
|
||||
fi
|
||||
|
||||
if grep -F -x -q -- "$skin" "$JSON_SKINS_TMP"; then
|
||||
echo " Already ordered (extra): $skin"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$skin_header" >> "$SEEN_HEADERS_FILE"
|
||||
|
||||
escaped_img=$(printf "%s" "$skin_header.gif" | sed 's/ /%20/g')
|
||||
escaped_osk=$(printf "%s" "$skin_header.osk" | sed 's/ /%20/g')
|
||||
|
||||
echo " Writing extra skin: $skin_header"
|
||||
echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/$escaped_osk)" >> "$README_PATH"
|
||||
echo "## [$header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/$osk)" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
|
||||
if [ -f "$ini_file" ]; then
|
||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n 1 || true)
|
||||
if [ -n "${author_line:-}" ]; then
|
||||
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||
if [ -n "$author" ]; then
|
||||
echo "**Author:** $author" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
if [ -f "$ini" ]; then
|
||||
author_line=$(grep -i '^[[:space:]]*Author:' "$ini" | head -n1)
|
||||
if [ -n "$author_line" ]; then
|
||||
auth="${author_line#*:}"
|
||||
auth="${auth#"${auth%%[![:space:]]*}"}"
|
||||
[ -n "$auth" ] && { echo "**Author:** $auth" >> "$README_PATH"; echo "" >> "$README_PATH"; }
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
|
||||
if [ -f "media/panel/${skin_header}.png" ]; then
|
||||
escaped_panel=$(printf "%s" "${skin_header}.png" | sed 's/ /%20/g')
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
|
||||
mod_icon_file="${skin_header}-mod-icons.png"
|
||||
if [ -f "media/icons/$mod_icon_file" ]; then
|
||||
escaped_mod=$(printf "%s" "$mod_icon_file" | sed 's/ /%20/g')
|
||||
echo "" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Step 7: Writing Build History section..."
|
||||
echo "Step 6: Build History..."
|
||||
echo "# Build History" >> "$README_PATH"
|
||||
echo "" >> "$README_PATH"
|
||||
echo "| Version | Date |" >> "$README_PATH"
|
||||
echo "| ------- | ---- |" >> "$README_PATH"
|
||||
|
||||
echo " Getting latest commit date..."
|
||||
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
|
||||
echo " Latest commit date: $current_commit_date"
|
||||
echo "| [\`$new_tag (Current)\`](https://git.sulejmani.xyz/arlind/skins/src/tag/$new_tag/README.md) | $current_commit_date |" >> "$README_PATH"
|
||||
|
||||
echo " Checking for old tags..."
|
||||
old_tags=$(git tag --sort=-v:refname | grep -v "^$new_tag$" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)
|
||||
|
||||
if [ -n "$old_tags" ]; then
|
||||
echo " Found old tags:"
|
||||
echo "$old_tags" | while read -r tag; do
|
||||
echo " Processing tag: $tag"
|
||||
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\`](https://git.sulejmani.xyz/arlind/skins/src/tag/$tag/README.md) | $formatted_date |" >> "$README_PATH"
|
||||
done
|
||||
else
|
||||
echo " No old tags found. Skipping old tags section."
|
||||
fi
|
||||
commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
|
||||
echo "| [\`$new_tag (Current)\`](https://git.sulejmani.xyz/arlind/skins/src/tag/$new_tag/README.md) | $commit_date |" >> "$README_PATH"
|
||||
for tag in $(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | grep -v "^$new_tag$"); do
|
||||
date=$(git log -1 --format=%ci "$tag")
|
||||
fmt=$(TZ="Europe/Zurich" date -d "$date" "+%d.%m.%Y %H:%M:%S")
|
||||
echo "| [\`$tag\`](https://git.sulejmani.xyz/arlind/skins/src/tag/$tag/README.md) | $fmt |" >> "$README_PATH"
|
||||
done
|
||||
|
||||
echo "README generation completed successfully."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user