generated from osc/skins-template
All checks were successful
Generate Skin previews, OSK files and per skin documentation / Detect Changed Skins (push) Successful in 3s
Generate Skin previews, OSK files and per skin documentation / Calculate Git Tag (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Prepare Assets (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Generate Videos and Screenshots (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Generate Mod Icons (WEBP) (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Create OSK Files (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Generate README (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Generate Per-Skin Docs (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Rename Assets Based on skin.ini (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Convert PNGs to WEBPs (push) Has been skipped
Generate Skin previews, OSK files and per skin documentation / Git Commit and Push (push) Has been skipped
1083 lines
40 KiB
YAML
1083 lines
40 KiB
YAML
name: Generate Skin previews, OSK files and per skin documentation
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '.gitea/workflows/*'
|
|
- 'Skins/**/*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
force_rebuild:
|
|
description: 'Force rebuild all skins'
|
|
required: false
|
|
default: 'false'
|
|
target_skins:
|
|
description: 'Comma-separated list of skin folder names to rebuild (e.g., "Skin1,Skin2")'
|
|
required: false
|
|
default: ''
|
|
soft_run:
|
|
description: 'Run doc/regeneration steps even if no skins changed'
|
|
required: false
|
|
default: 'false'
|
|
|
|
env:
|
|
DANSER_PATH: "/app/danser/danser-cli"
|
|
DANSER_DIR: "/app/danser"
|
|
DANSER_VIDEO_DIR: "/app/danser/videos"
|
|
DANSER_SCREENSHOT_DIR: "/app/danser/screenshots"
|
|
SKINS_DIR: "${{ github.workspace }}/Skins"
|
|
DANSER_SKINS_DIR: "/app/danser/skins"
|
|
DEFAULT_SKIN_DIR: "/app/danser/skins/default-skin"
|
|
REPO_SCREENSHOT_DIR: "${{ github.workspace }}/media/gameplay"
|
|
REPO_MOD_ICONS_DIR: "${{ github.workspace }}/media/icons"
|
|
REPO_RANKING_PANEL_DIR: "${{ github.workspace }}/media/panel"
|
|
REPO_THUMBNAIL_DIR: "${{ github.workspace }}/media/thumbnail"
|
|
SETTINGS_JSON_PATH: "/app/danser/settings/default.json"
|
|
README_PATH: "${{ github.workspace }}/README.md"
|
|
GAMEPLAY_REPLAY_PATH: "/app/danser/custom-replays/yomi_yori.osr"
|
|
THUMBNAIL_REPLAY_PATH: "/app/danser/custom-replays/combo_colors.osr"
|
|
PANEL_REPLAY_PATH: "/app/danser/custom-replays/2000_gekis.osr"
|
|
OSK_PATH: "${{ github.workspace }}/export"
|
|
IMAGE_NAME: osc/skins-image
|
|
REGISTRY_URL: "https://${{ vars.CONTAINER_REGISTRY }}"
|
|
OSU_ID: ${{ vars.OSUID }}
|
|
DOC_DIR: "${{ github.workspace }}/docs"
|
|
|
|
jobs:
|
|
detect_changed_skins:
|
|
name: Detect Changed Skins
|
|
runs-on: danser
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
outputs:
|
|
has_changes: ${{ steps.set.outputs.has_changes }}
|
|
soft_run: ${{ github.event.inputs.soft_run || 'false' }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Discover all skins
|
|
id: discover
|
|
shell: bash
|
|
run: |
|
|
echo "Discovering all skins…"
|
|
mapfile -t skins < <(
|
|
find "${{ env.SKINS_DIR }}" -mindepth 1 -maxdepth 1 -type d \
|
|
| sed 's|.*/||'
|
|
)
|
|
{
|
|
echo 'ALL_SKINS_DIR<<EOF'
|
|
for s in "${skins[@]}"; do
|
|
echo "$s"
|
|
done
|
|
echo 'EOF'
|
|
} >> "$GITHUB_ENV"
|
|
|
|
- name: Detect changed skins
|
|
id: detect
|
|
shell: bash
|
|
run: |
|
|
readarray -t all_skins <<< "$ALL_SKINS_DIR"
|
|
|
|
force_rebuild="${{ github.event.inputs.force_rebuild }}"
|
|
target_skins="${{ github.event.inputs.target_skins }}"
|
|
skins=()
|
|
|
|
if [[ "$force_rebuild" == "true" ]]; then
|
|
skins=("${all_skins[@]}")
|
|
elif [[ -n "$target_skins" ]]; then
|
|
IFS=',' read -r -a input_skins <<< "$target_skins"
|
|
for s in "${input_skins[@]}"; do
|
|
s="${s## }"; s="${s%% }"
|
|
[[ -n "$s" ]] && skins+=("$s")
|
|
done
|
|
else
|
|
latest_tag=$(git tag --sort=-creatordate | head -n 1 || true)
|
|
if [[ -n "$latest_tag" ]]; then
|
|
mapfile -t skins < <(
|
|
git diff --name-only -z --diff-filter=AM "$latest_tag" HEAD |
|
|
while IFS= read -r -d '' file; do
|
|
[[ $file == Skins/* ]] && echo "${file#Skins/}" | cut -d/ -f1
|
|
done | sort -u
|
|
)
|
|
else
|
|
skins=("${all_skins[@]}")
|
|
fi
|
|
fi
|
|
|
|
uniq_skins=()
|
|
for skin in "${skins[@]}"; do
|
|
skin="${skin## }"; skin="${skin%% }"
|
|
[[ -n "$skin" ]] && uniq_skins+=("$skin")
|
|
done
|
|
|
|
if [[ ${#uniq_skins[@]} -eq 0 ]]; then
|
|
echo "No skins changed"
|
|
echo "CHANGED_SKINS_FILE=" >> "$GITHUB_ENV"
|
|
else
|
|
changed_file="/tmp/changed_skins.txt"
|
|
printf "%s\n" "${uniq_skins[@]}" > "$changed_file"
|
|
echo "CHANGED_SKINS_FILE=$changed_file" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
- name: Extract Repository Path
|
|
shell: bash
|
|
run: |
|
|
repo="${{ github.workspace }}"
|
|
repo="${repo#/workspace/}"
|
|
repo="${repo%/}"
|
|
echo "USER_REPOSITORY=$repo" >> "$GITHUB_ENV"
|
|
|
|
- name: Set outputs
|
|
id: set
|
|
shell: bash
|
|
run: |
|
|
has_changes=false
|
|
if [ -n "${CHANGED_SKINS_FILE:-}" ] && [ -s "$CHANGED_SKINS_FILE" ]; then
|
|
has_changes=true
|
|
fi
|
|
echo "has_changes=$has_changes" >> "$GITHUB_OUTPUT"
|
|
|
|
calculate_git_tag:
|
|
name: Calculate Git Tag
|
|
runs-on: danser
|
|
needs: detect_changed_skins
|
|
if: >-
|
|
needs.detect_changed_skins.outputs.has_changes == 'true' ||
|
|
github.event.inputs.soft_run == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
outputs:
|
|
new_tag: ${{ steps.tag.outputs.new_tag }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
tags: true
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Calculate new tag
|
|
id: tag
|
|
shell: bash
|
|
run: |
|
|
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "")
|
|
if [ -z "$latest_tag" ]; then
|
|
new_tag="v1.0.0"
|
|
else
|
|
IFS='.' read -r major minor patch <<< "${latest_tag#v}"
|
|
minor=$((minor + 1))
|
|
patch=0
|
|
new_tag="v${major}.${minor}.${patch}"
|
|
fi
|
|
echo "new_tag=$new_tag" >> "$GITHUB_OUTPUT"
|
|
|
|
prepare_assets:
|
|
name: Prepare Assets
|
|
runs-on: danser
|
|
needs: detect_changed_skins
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
tags: true
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Pull Git LFS for changed skins and core assets
|
|
shell: bash
|
|
run: |
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping git pull lfs."
|
|
exit 0
|
|
fi
|
|
|
|
includes="src/**,export/**,media/**"
|
|
|
|
skin_includes=$(
|
|
while IFS= read -r skin; do
|
|
esc=$(printf '%s' "$skin" \
|
|
| sed -e 's/\[/\\[/g' -e 's/\]/\\]/g')
|
|
printf 'Skins/%s/**\n' "$esc"
|
|
done < "$CHANGED_SKINS_FILE" \
|
|
| paste -sd ','
|
|
)
|
|
|
|
includes="$includes,$skin_includes"
|
|
|
|
echo "→ Pulling LFS objects for: $includes"
|
|
git lfs pull --include="$includes"
|
|
|
|
- name: Set XDG_RUNTIME_DIR
|
|
shell: bash
|
|
run: |
|
|
mkdir -p /tmp/xdg_runtime_dir
|
|
chmod 0700 /tmp/xdg_runtime_dir
|
|
echo "XDG_RUNTIME_DIR=/tmp/xdg_runtime_dir" >> "$GITHUB_ENV"
|
|
|
|
- name: Create directories for assets
|
|
shell: bash
|
|
run: |
|
|
mkdir -p "$REPO_SCREENSHOT_DIR" "$REPO_MOD_ICONS_DIR" "$REPO_RANKING_PANEL_DIR" "$OSK_PATH" "$REPO_THUMBNAIL_DIR"
|
|
|
|
readarray -t skins <<< "$ALL_SKINS_DIR"
|
|
for skin in "${skins[@]}"; do
|
|
mkdir -p \
|
|
"$REPO_SCREENSHOT_DIR/$skin" \
|
|
"$REPO_MOD_ICONS_DIR/$skin" \
|
|
"$REPO_RANKING_PANEL_DIR/$skin" \
|
|
"$OSK_PATH/$skin" \
|
|
"$REPO_THUMBNAIL_DIR/$skin"
|
|
done
|
|
|
|
generate_videos_and_screenshots:
|
|
name: Generate Videos and Screenshots
|
|
runs-on: danser
|
|
needs: prepare_assets
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
options: >-
|
|
--gpus all
|
|
--env NVIDIA_DRIVER_CAPABILITIES=all
|
|
--env NVIDIA_VISIBLE_DEVICES=all
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Move Skin files to Danser Skins directory
|
|
shell: bash
|
|
run: |
|
|
echo "Moving Skin files to Danser Skins directory..."
|
|
mkdir -p "$DANSER_SKINS_DIR"
|
|
mv "$SKINS_DIR"/* "$DANSER_SKINS_DIR"
|
|
echo "Skin files moved."
|
|
|
|
- name: Generate Danser videos and screenshots
|
|
shell: bash
|
|
run: |
|
|
echo "[Danser Job Started]"
|
|
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping generation."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t skins < "$CHANGED_SKINS_FILE"
|
|
[ "${#skins[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; }
|
|
|
|
SKIN_COUNT=${#skins[@]}
|
|
INDEX=1
|
|
|
|
for skin_path in "${skins[@]}"; do
|
|
[ -z "$skin_path" ] && continue
|
|
SKIN_DIR="$DANSER_SKINS_DIR/$skin_path"
|
|
[ ! -d "$SKIN_DIR" ] && { echo "Skipping missing skin: $skin_path"; continue; }
|
|
|
|
SKIN_NAME="$skin_path"
|
|
OUT_VIDEO_DIR="$REPO_SCREENSHOT_DIR/$SKIN_NAME"
|
|
OUT_PNG_DIR="$REPO_RANKING_PANEL_DIR/$SKIN_NAME"
|
|
OUT_THUMBNAIL_DIR="$REPO_THUMBNAIL_DIR/$SKIN_NAME"
|
|
|
|
echo ""
|
|
echo "[$INDEX/$SKIN_COUNT] Generating for skin: $SKIN_NAME"
|
|
|
|
LOGFILE="/tmp/danser_log_$INDEX.txt"
|
|
|
|
echo " → Generating video..."
|
|
if ! xvfb-run -a "$DANSER_PATH" \
|
|
-replay "$GAMEPLAY_REPLAY_PATH" -record -skip -start=300 -end=307 -noupdatecheck \
|
|
-out="$SKIN_NAME" -skin="$SKIN_NAME" >"$LOGFILE" 2>&1; then
|
|
echo " ✖ Video failed for $SKIN_NAME"; cat "$LOGFILE"; INDEX=$((INDEX+1)); continue
|
|
fi
|
|
|
|
if [ -f "$DANSER_VIDEO_DIR/$SKIN_NAME.mp4" ]; then
|
|
echo " → Trimming MP4 with ffmpeg..."
|
|
ffmpeg -hide_banner -loglevel error \
|
|
-ss 5 -t 6.5 \
|
|
-i "$DANSER_VIDEO_DIR/$SKIN_NAME.mp4" \
|
|
-c:v h264_nvenc -preset fast \
|
|
-c:a aac -b:a 128k \
|
|
"$DANSER_VIDEO_DIR/${SKIN_NAME}_trimmed.mp4"
|
|
|
|
if [ -f "$DANSER_VIDEO_DIR/${SKIN_NAME}_trimmed.mp4" ]; then
|
|
mv "$DANSER_VIDEO_DIR/${SKIN_NAME}_trimmed.mp4" "$DANSER_VIDEO_DIR/$SKIN_NAME.mp4"
|
|
mkdir -p "$OUT_VIDEO_DIR"
|
|
mv "$DANSER_VIDEO_DIR/$SKIN_NAME.mp4" "$OUT_VIDEO_DIR/$SKIN_NAME.mp4"
|
|
echo " ✓ Trimmed MP4 moved to $OUT_VIDEO_DIR/"
|
|
else
|
|
echo " ✖ ffmpeg trimming failed for $SKIN_NAME"
|
|
fi
|
|
else
|
|
echo " ✖ No MP4 found for $SKIN_NAME"
|
|
fi
|
|
|
|
echo " → Taking screenshot..."
|
|
if ! xvfb-run -a "$DANSER_PATH" \
|
|
-replay "$PANEL_REPLAY_PATH" -skip -noupdatecheck -ss 28 \
|
|
-out="$SKIN_NAME" -skin="$SKIN_NAME" >>"$LOGFILE" 2>&1; then
|
|
echo " ✖ Screenshot failed for $SKIN_NAME"; cat "$LOGFILE"; INDEX=$((INDEX+1)); continue
|
|
fi
|
|
|
|
if [ -f "$DANSER_SCREENSHOT_DIR/$SKIN_NAME.png" ]; then
|
|
mkdir -p "$OUT_PNG_DIR"
|
|
mv "$DANSER_SCREENSHOT_DIR/$SKIN_NAME.png" "$OUT_PNG_DIR/$SKIN_NAME.png"
|
|
echo " ✓ PNG moved to $OUT_PNG_DIR/"
|
|
else
|
|
echo " ✖ No PNG found for $SKIN_NAME"
|
|
fi
|
|
|
|
echo " → Taking thumbnail screenshot..."
|
|
if ! xvfb-run -a "$DANSER_PATH" \
|
|
-replay "$THUMBNAIL_REPLAY_PATH" -skip -noupdatecheck -ss 1.3 \
|
|
-out="${SKIN_NAME}_thumb" -skin="$SKIN_NAME" >>"$LOGFILE" 2>&1; then
|
|
echo " ✖ Thumbnail screenshot failed for $SKIN_NAME"; cat "$LOGFILE"; INDEX=$((INDEX+1)); continue
|
|
fi
|
|
|
|
if [ -f "$DANSER_SCREENSHOT_DIR/${SKIN_NAME}_thumb.png" ]; then
|
|
mkdir -p "$OUT_THUMBNAIL_DIR"
|
|
mv "$DANSER_SCREENSHOT_DIR/${SKIN_NAME}_thumb.png" "$OUT_THUMBNAIL_DIR/$SKIN_NAME.png"
|
|
echo " ✓ Thumbnail PNG moved to $OUT_THUMBNAIL_DIR/"
|
|
else
|
|
echo " ✖ No thumbnail PNG found for $SKIN_NAME"
|
|
fi
|
|
|
|
INDEX=$((INDEX + 1))
|
|
done
|
|
|
|
echo ""
|
|
echo "[Danser Job Finished — processed $SKIN_COUNT skins]"
|
|
|
|
rename_assets_from_skin_ini:
|
|
name: Rename Assets Based on skin.ini
|
|
runs-on: danser
|
|
needs: generate_videos_and_screenshots
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Rename assets based on skin.ini
|
|
shell: bash
|
|
run: |
|
|
echo "[Asset Renaming Job Started]"
|
|
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping asset renaming."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t skins < "$CHANGED_SKINS_FILE"
|
|
[ "${#skins[@]}" -eq 0 ] && { echo "No skins to rename. Exiting."; exit 0; }
|
|
|
|
sanitize_filename() {
|
|
echo "$1" | tr -d '\000-\037' \
|
|
| sed -e 's#[\\/:\*\?"<>|]#-#g' \
|
|
-e 's/^[[:space:]]*//' \
|
|
-e 's/[[:space:]]*$//'
|
|
}
|
|
|
|
SKIN_COUNT=${#skins[@]}
|
|
INDEX=1
|
|
|
|
for skin_path in "${skins[@]}"; do
|
|
[ -z "$skin_path" ] && continue
|
|
SKIN_DIR_NAME="$skin_path"
|
|
SKIN_DIR="$SKINS_DIR/$skin_path"
|
|
[ ! -d "$SKIN_DIR" ] && { echo "Skipping missing skin directory: $SKIN_DIR"; continue; }
|
|
|
|
echo "Processing skin $INDEX/$SKIN_COUNT: $SKIN_DIR_NAME"
|
|
|
|
skin_header="$SKIN_DIR_NAME"
|
|
ini_file=$(find "$SKIN_DIR" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
|
if [ -f "$ini_file" ]; then
|
|
name_line=$(grep -i '^[[:space:]]*Name:' "$ini_file" | head -n1 || true)
|
|
if [ -n "$name_line" ]; then
|
|
val="${name_line#*:}"
|
|
val="$(echo "$val" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
if [ -n "$val" ]; then
|
|
sanitized="$(sanitize_filename "$val")"
|
|
[ -n "$sanitized" ] && skin_header="$sanitized"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
VIDEO_DIR="$REPO_SCREENSHOT_DIR/$SKIN_DIR_NAME"
|
|
PNG_DIR="$REPO_RANKING_PANEL_DIR/$SKIN_DIR_NAME"
|
|
THUMBNAIL_DIR="$REPO_THUMBNAIL_DIR/$SKIN_DIR_NAME"
|
|
|
|
if [ -f "$VIDEO_DIR/$SKIN_DIR_NAME.mp4" ] && [ "$SKIN_DIR_NAME" != "$skin_header" ]; then
|
|
mv -f "$VIDEO_DIR/$SKIN_DIR_NAME.mp4" "$VIDEO_DIR/$skin_header.mp4" || true
|
|
echo " ✓ Renamed MP4 to $VIDEO_DIR/$skin_header.mp4"
|
|
fi
|
|
|
|
if [ -f "$PNG_DIR/$SKIN_DIR_NAME.png" ] && [ "$SKIN_DIR_NAME" != "$skin_header" ]; then
|
|
mv -f "$PNG_DIR/$SKIN_DIR_NAME.png" "$PNG_DIR/$skin_header.png" || true
|
|
echo " ✓ Renamed PNG to $PNG_DIR/$skin_header.png"
|
|
fi
|
|
|
|
if [ -f "$THUMBNAIL_DIR/$SKIN_DIR_NAME.png" ] && [ "$SKIN_DIR_NAME" != "$skin_header" ]; then
|
|
mv -f "$THUMBNAIL_DIR/$SKIN_DIR_NAME.png" "$THUMBNAIL_DIR/$skin_header.png" || true
|
|
echo " ✓ Renamed thumbnail to $THUMBNAIL_DIR/$skin_header.png"
|
|
fi
|
|
|
|
INDEX=$((INDEX + 1))
|
|
done
|
|
|
|
echo ""
|
|
echo "[Asset Renaming Complete — processed $SKIN_COUNT skins]"
|
|
|
|
generate_mod_icons:
|
|
name: Generate Mod Icons (WEBP)
|
|
runs-on: danser
|
|
needs: prepare_assets
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Generate mod icon montages
|
|
shell: bash
|
|
run: |
|
|
echo "[Mod Icon Generation Job Started]"
|
|
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping mod icon generation."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t skin_dirs < "$CHANGED_SKINS_FILE"
|
|
[ "${#skin_dirs[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; }
|
|
|
|
sanitize_filename() {
|
|
echo "$1" | tr -d '\000-\037' \
|
|
| sed -e 's#[\\/:\*\?"<>|]#-#g' \
|
|
-e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
}
|
|
|
|
ICONS_JSON_FILE="${{ github.workspace }}/.gitea/workflows/icons.json"
|
|
group1_icons=$(jq -r '.group1 | join(\" \")' "$ICONS_JSON_FILE")
|
|
group2_icons=$(jq -r '.group2 | join(\" \")' "$ICONS_JSON_FILE")
|
|
group3_icons=$(jq -r '.group3 | join(\" \")' "$ICONS_JSON_FILE")
|
|
|
|
BLANK_IMAGE=\"blank.png\"
|
|
magick -size \"160x160\" xc:none \"$BLANK_IMAGE\"
|
|
|
|
SKIN_COUNT=${#skin_dirs[@]}
|
|
INDEX=1
|
|
|
|
for skin_path in \"${skin_dirs[@]}\"; do
|
|
SKIN_DIR=\"$SKINS_DIR/$skin_path\"
|
|
[ ! -d \"$SKIN_DIR\" ] && { echo \"Skipping missing skin directory: $SKIN_DIR\"; ((INDEX++)); continue; }
|
|
|
|
skin_header=\"$skin_path\"
|
|
ini_file=$(find \"$SKIN_DIR\" -maxdepth 1 -iname \"skin.ini\" | head -n1 || true)
|
|
if [ -f \"$ini_file\" ]; then
|
|
name_line=$(grep -i '^[[:space:]]*Name:' \"$ini_file\" | head -n1 || 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
|
|
fi
|
|
|
|
echo \"\"
|
|
echo \"[$INDEX/$SKIN_COUNT] Skin: $skin_header\"
|
|
|
|
ICON_FOLDER=\"$SKIN_DIR\"
|
|
OUTPUT_DIR=\"$REPO_MOD_ICONS_DIR/$skin_path\"
|
|
mkdir -p \"$OUTPUT_DIR\"
|
|
OUTPUT=\"$OUTPUT_DIR/${skin_header}-mod-icons.webp\"
|
|
|
|
row_images=()
|
|
row_index=1
|
|
|
|
for group_list in \"$group1_icons\" \"$group2_icons\" \"$group3_icons\"; do
|
|
montage_files=()
|
|
for icon in $group_list; do
|
|
file=\"\"
|
|
if [ -f \"${ICON_FOLDER}/selection-mod-${icon}@2x.png\" ]; then
|
|
file=\"${ICON_FOLDER}/selection-mod-${icon}@2x.png\"
|
|
elif [ -f \"${ICON_FOLDER}/selection-mod-${icon}.png\" ]; then
|
|
file=\"${ICON_FOLDER}/selection-mod-${icon}.png\"
|
|
elif [ -f \"${DEFAULT_SKIN_DIR}/selection-mod-${icon}@2x.png\" ]; then
|
|
file=\"${DEFAULT_SKIN_DIR}/selection-mod-${icon}@2x.png\"
|
|
fi
|
|
[ -n \"$file\" ] && montage_files+=(\"$file\")
|
|
done
|
|
|
|
while [ \"${#montage_files[@]}\" -lt 7 ]; do
|
|
montage_files+=(\"$BLANK_IMAGE\")
|
|
done
|
|
|
|
magick montage \"${montage_files[@]}\" \
|
|
-tile \"7x1\" -geometry \"160x160+10+10\" -background none \
|
|
\"row_${row_index}.png\"
|
|
row_images+=(\"row_${row_index}.png\")
|
|
row_index=$((row_index + 1))
|
|
done
|
|
|
|
magick montage \"${row_images[@]}\" \
|
|
-tile \"1x${#row_images[@]}\" -geometry \"+10+10\" -background none \
|
|
\"temp_combined.png\"
|
|
|
|
magick \"temp_combined.png\" -define webp:lossless=true \"$OUTPUT\"
|
|
rm temp_combined.png row_*.png
|
|
|
|
echo \" ✓ Mod Icons Generated at $OUTPUT\"
|
|
INDEX=$((INDEX + 1))
|
|
done
|
|
|
|
rm \"$BLANK_IMAGE\"
|
|
echo \"\"
|
|
echo \"[Mod Icon Generation Finished — processed $SKIN_COUNT skins]\"
|
|
|
|
convert_png_to_webp:
|
|
name: Convert PNGs to WEBPs
|
|
runs-on: danser
|
|
needs: generate_mod_icons
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Convert PNG to WEBP format
|
|
shell: bash
|
|
run: |
|
|
echo "[Convert PNG → WEBP Started]"
|
|
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping conversion."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t skins < "$CHANGED_SKINS_FILE"
|
|
[ "${#skins[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; }
|
|
|
|
convert_pngs_to_webp() {
|
|
local base_dir="$1"
|
|
local skin_path="$2"
|
|
local dir="$base_dir/$skin_path"
|
|
echo " → Processing: $dir"
|
|
[ ! -d "$dir" ] && { echo " ✖ Directory does not exist: $dir"; return; }
|
|
find "$dir" -type f -iname "*.png" | while read -r png; do
|
|
webp="${png%.png}.webp"
|
|
echo " ↳ Converting: $png → $webp"
|
|
magick "$png" -define webp:lossless=false -quality 90 "$webp" && rm -f "$png"
|
|
done
|
|
}
|
|
|
|
for skin_path in "${skins[@]}"; do
|
|
[ -z "$skin_path" ] && continue
|
|
convert_pngs_to_webp "$REPO_RANKING_PANEL_DIR" "$skin_path"
|
|
convert_pngs_to_webp "$REPO_THUMBNAIL_DIR" "$skin_path"
|
|
done
|
|
|
|
echo "[Convert PNG → WEBP Finished]"
|
|
|
|
create_osk_files:
|
|
name: Create OSK Files
|
|
runs-on: danser
|
|
needs: prepare_assets
|
|
if: needs.detect_changed_skins.outputs.has_changes == 'true'
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Create OSK archives
|
|
shell: bash
|
|
run: |
|
|
echo "[OSK Creation Job Started]"
|
|
|
|
if [ -z "${CHANGED_SKINS_FILE:-}" ] || [ ! -s "$CHANGED_SKINS_FILE" ]; then
|
|
echo "No skins changed. Skipping OSK creation."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t skin_dirs < "$CHANGED_SKINS_FILE"
|
|
[ "${#skin_dirs[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; }
|
|
|
|
sanitize_filename() {
|
|
echo "$1" | tr -d '\000-\037' \
|
|
| sed -e 's#[\\/:\*\?"<>|]#-#g' \
|
|
-e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
}
|
|
|
|
FIXED_TIMESTAMP="2025-01-01 00:00:00"
|
|
SKIN_COUNT=${#skin_dirs[@]}
|
|
INDEX=1
|
|
|
|
for skin_path in "${skin_dirs[@]}"; do
|
|
SKIN_DIR="$SKINS_DIR/$skin_path"
|
|
[ ! -d "$SKIN_DIR" ] && { echo "Skipping missing skin directory: $SKIN_DIR"; ((INDEX++)); continue; }
|
|
|
|
OUTPUT_DIR="$OSK_PATH/$skin_path"
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
skin_header="$skin_path"
|
|
ini_file=$(find "$SKIN_DIR" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
|
if [ -f "$ini_file" ]; then
|
|
name_line=$(grep -i '^[[:space:]]*name:' "$ini_file" | head -n1 || true)
|
|
if [ -n "$name_line" ]; then
|
|
val="${name_line#*:}"
|
|
val="$(echo "$val" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
if [ -n "$val" ]; then
|
|
sanitized="$(sanitize_filename "$val")"
|
|
[ -n "$sanitized" ] && skin_header="$sanitized"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo "[$INDEX/$SKIN_COUNT] Processing skin: $skin_header"
|
|
|
|
(cd "$SKIN_DIR" && find . -type f -exec touch -d "$FIXED_TIMESTAMP" {} +)
|
|
|
|
(cd "$SKIN_DIR" && find . -type f | sort | \
|
|
zip -rq -D -X -9 --compression-method deflate \
|
|
"$OUTPUT_DIR/${skin_header}.osk" -@)
|
|
|
|
echo " ✓ OSK file created at $OUTPUT_DIR/${skin_header}.osk"
|
|
INDEX=$((INDEX + 1))
|
|
done
|
|
|
|
echo ""
|
|
echo "[OSK Creation Job Finished — processed $SKIN_COUNT skins]"
|
|
|
|
generate_readme_index:
|
|
name: Generate README
|
|
runs-on: danser
|
|
needs: calculate_git_tag
|
|
if: (needs.detect_changed_skins.outputs.has_changes == 'true') || (github.event.inputs.soft_run == 'true')
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Generate README markdown
|
|
shell: bash
|
|
run: |
|
|
echo "Generating README index…"
|
|
|
|
mkdir -p /tmp/skins-docs
|
|
export README_PATH="/tmp/skins-docs/README.md"
|
|
|
|
sanitize_filename() {
|
|
echo "$1" | tr -d '\000-\037' \
|
|
| sed -e 's#[\\/:\*\?"<>|]#-#g' -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"
|
|
}
|
|
|
|
SKINS_JSON_FILE="${{ github.workspace }}/.gitea/workflows/skins.json"
|
|
DESC_FILE=$(mktemp)
|
|
|
|
echo "---" > "$README_PATH"
|
|
echo "gitea: none" >> "$README_PATH"
|
|
echo "include_toc: true" >> "$README_PATH"
|
|
echo "---" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
echo "# Skins" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
echo "<!--" >> "$README_PATH"
|
|
echo "osuid: $OSU_ID" >> "$README_PATH"
|
|
echo "-->" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
echo "**Go back to [osc/skins]($REGISTRY_URL/osc/skins)**" >> "$README_PATH"
|
|
echo "" >> "$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.**" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
|
|
jq -r '.descriptions | to_entries[] | "\(.key)=\(.value)"' "$SKINS_JSON_FILE" > "$DESC_FILE"
|
|
jq -r '.order[]?' "$SKINS_JSON_FILE" > order.txt
|
|
|
|
get_desc() {
|
|
grep -F -m1 -- "$1=" "$DESC_FILE" 2>/dev/null | cut -d '=' -f2- || true
|
|
}
|
|
|
|
declare -A ordered
|
|
while IFS= read -r skin; do
|
|
ordered["$skin"]=1
|
|
dir="$SKINS_DIR/$skin"
|
|
[ ! -d "$dir" ] && continue
|
|
|
|
ini_file=$(find "$dir" -maxdepth 1 -iname "skin.ini" | head -n1 || true)
|
|
skin_header="$skin"
|
|
|
|
if [ -f "$ini_file" ]; then
|
|
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
|
|
fi
|
|
|
|
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/${{ needs.calculate_git_tag.outputs.new_tag }}/export/${base_path}.osk)" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
|
|
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 -n1 || true)
|
|
if [ -n "$author_line" ]; then
|
|
author=$(echo "$author_line" | cut -d ':' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
[ -n "$author" ] && { echo "**Author:** $author" >> "$README_PATH"; echo "" >> "$README_PATH"; }
|
|
fi
|
|
fi
|
|
|
|
echo "[](/docs/${base_path}.md)" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
done < order.txt
|
|
|
|
echo "# Build History" >> "$README_PATH"
|
|
echo "" >> "$README_PATH"
|
|
echo "| Version | Date |" >> "$README_PATH"
|
|
echo "| ------- | ---- |" >> "$README_PATH"
|
|
|
|
current_commit_date=$(TZ="Europe/Zurich" date -d "$(git log -1 --format=%cI)" "+%d.%m.%Y %H:%M:%S")
|
|
echo "| [${{ needs.calculate_git_tag.outputs.new_tag }} (Current)]($REGISTRY_URL/$USER_REPOSITORY/src/tag/${{ needs.calculate_git_tag.outputs.new_tag }}/README.md) | $current_commit_date |" >> "$README_PATH"
|
|
|
|
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ needs.calculate_git_tag.outputs.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 "| [${{ needs.calculate_git_tag.outputs.new_tag }}]($REGISTRY_URL/$USER_REPOSITORY/src/tag/$tag/README.md) | $formatted_date |" >> "$README_PATH"
|
|
done
|
|
fi
|
|
|
|
echo "README index generated successfully."
|
|
|
|
- name: Upload README
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: updated-index-readme
|
|
path: /tmp/skins-docs
|
|
|
|
generate_per_skin_docs:
|
|
name: Generate Per-Skin Docs
|
|
runs-on: danser
|
|
needs: calculate_git_tag
|
|
if: (needs.detect_changed_skins.outputs.has_changes == 'true') || (github.event.inputs.soft_run == 'true')
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Generate individual skin markdown pages
|
|
shell: bash
|
|
run: |
|
|
echo "Generating per-skin docs…"
|
|
|
|
mkdir -p /tmp/skins-docs
|
|
export DOC_DIR="/tmp/skins-docs/"
|
|
|
|
sanitize_filename() {
|
|
echo "$1" | tr -d '\000-\037' \
|
|
| sed -e 's#[\\/:\*\?"<>|]#-#g' -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 "$DOC_DIR"
|
|
|
|
for dir in "$SKINS_DIR"/*; do
|
|
[ -d "$dir" ] || continue
|
|
|
|
skin=$(basename "$dir")
|
|
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
|
|
|
|
raw_path="${skin}/${skin_header}"
|
|
base_path=$(url_encode_path "$raw_path")
|
|
osk_url="$REGISTRY_URL/$USER_REPOSITORY/media/tag/${{ needs.calculate_git_tag.outputs.new_tag }}/export/${base_path}.osk"
|
|
md_file_path="${DOC_DIR}/${raw_path}.md"
|
|
|
|
mkdir -p "$(dirname "$md_file_path")"
|
|
video_url="$REGISTRY_URL/$USER_REPOSITORY/raw/tag/${{ needs.calculate_git_tag.outputs.new_tag }}/media/gameplay/${base_path}.mp4"
|
|
|
|
author=""
|
|
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:]]*$//')
|
|
fi
|
|
fi
|
|
|
|
{
|
|
echo "# [$skin_header]($osk_url)"
|
|
echo ""
|
|
[ -n "$author" ] && echo "**Author:** $author"
|
|
[ -n "$author" ] && echo ""
|
|
|
|
echo "## Hitsounds"
|
|
echo "<video controls autoplay loop muted playsinline src=\"$video_url\" type=\"video/mp4\"></video>"
|
|
echo ""
|
|
|
|
echo "## Ranking Panel"
|
|
echo ""
|
|
echo ""
|
|
|
|
echo "## Mod Icons"
|
|
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")
|
|
echo "| [\${{ needs.calculate_git_tag.outputs.new_tag }} (Current)\]($REGISTRY_URL/$USER_REPOSITORY/src/tag/${{ needs.calculate_git_tag.outputs.new_tag }}/docs/${base_path}.md) | $current_commit_date |"
|
|
|
|
old_tags=$(git tag --sort=-v:refname | grep -v "^${{ needs.calculate_git_tag.outputs.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
|
|
raw_osk_path="export/${skin}/${skin_header}.osk"
|
|
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 |"
|
|
fi
|
|
done
|
|
fi
|
|
} > "$md_file_path"
|
|
|
|
echo " → Wrote $md_file_path"
|
|
done
|
|
|
|
echo "Per-skin markdown pages complete."
|
|
|
|
- name: Upload README
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: updated-per-skin-readme
|
|
path: /tmp/skins-docs
|
|
|
|
# cleanup_extra_files:
|
|
# name: Cleanup Extra Files
|
|
# runs-on: danser
|
|
# needs: detect_changed_skins
|
|
# if: (needs.detect_changed_skins.outputs.has_changes == 'true') || (github.event.inputs.soft_run == 'true')
|
|
# container:
|
|
# image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
# steps:
|
|
# - name: Checkout repository
|
|
# uses: actions/checkout@v4
|
|
# with:
|
|
# token: ${{ secrets.TOKEN }}
|
|
#
|
|
# - name: Cleanup redundant and obsolete files
|
|
# shell: bash
|
|
# run: |
|
|
# echo "[Cleanup Extra Files Started]"
|
|
#
|
|
# [ -f how-to-use.md ] && rm -f how-to-use.md
|
|
# [ -f src/replay.osr ] && rm -f src/replay.osr
|
|
# [ -d src/default-skin ] && rm -rf src/default-skin
|
|
#
|
|
# readarray -t skins <<< "$ALL_SKINS_DIR"
|
|
#
|
|
# sanitize_filename() {
|
|
# echo "$1" | \
|
|
# tr -d '\000-\037' | \
|
|
# sed -e 's#[\\/:\*\?"<>|]#-#g' | \
|
|
# sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
# }
|
|
#
|
|
# prune_dir() {
|
|
# local root="$1"
|
|
# local skin="$2"
|
|
# local expected="$3"
|
|
#
|
|
# for f in "$root"/*; do
|
|
# [ -f "$f" ] || continue
|
|
# name="$(basename "$f")"
|
|
# if printf '%s\n' "${skins[@]}" | grep -Fxq -- "$name"; then
|
|
# continue
|
|
# fi
|
|
# echo " → Removing unexpected root file: $f"
|
|
# rm -f "$f"
|
|
# done
|
|
#
|
|
# dir="$root/$skin"
|
|
# [ -d "$dir" ] || return
|
|
# for f in "$dir"/*; do
|
|
# [ -e "$f" ] || continue
|
|
# if [[ "$(basename "$f")" != "$expected" ]]; then
|
|
# echo " → Removing unexpected file: $f"
|
|
# rm -f "$f"
|
|
# fi
|
|
# done
|
|
# }
|
|
#
|
|
# for root in "$REPO_SCREENSHOT_DIR" "$REPO_RANKING_PANEL_DIR" "$REPO_MOD_ICONS_DIR" "$REPO_THUMBNAIL_DIR" "$OSK_PATH" "$DOC_DIR"; do
|
|
# [ -d "$root" ] || continue
|
|
# for dir in "$root"/*; do
|
|
# [ -d "$dir" ] || continue
|
|
# name="$(basename "$dir")"
|
|
# if ! printf '%s\n' "${skins[@]}" | grep -Fxq -- "$name"; then
|
|
# echo " → Skin '$name' deleted—removing directory $dir"
|
|
# rm -rf "$dir"
|
|
# fi
|
|
# done
|
|
# done
|
|
#
|
|
# for skin in "${skins[@]}"; do
|
|
# header=$(sanitize_filename "$skin")
|
|
# ini=$(find "$SKINS_DIR/$skin" -maxdepth 1 -type f -iname "skin.ini" -print -quit || true)
|
|
# if [[ -f "$ini" ]]; then
|
|
# raw=$(grep -i '^[[:space:]]*Name:' "$ini" | head -n1 || true)
|
|
# raw="${raw#*:}"
|
|
# raw="$(echo "$raw" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
# tmp_header=$(sanitize_filename "$raw")
|
|
# [[ -n "$tmp_header" ]] && header="$tmp_header"
|
|
# fi
|
|
#
|
|
# prune_dir "$REPO_SCREENSHOT_DIR" "$skin" "$header.mp4"
|
|
# prune_dir "$REPO_RANKING_PANEL_DIR" "$skin" "$header.webp"
|
|
# prune_dir "$REPO_MOD_ICONS_DIR" "$skin" "$header-mod-icons.webp"
|
|
# prune_dir "$REPO_THUMBNAIL_DIR" "$skin" "$header.webp"
|
|
# prune_dir "$OSK_PATH" "$skin" "$header.osk"
|
|
# prune_dir "$DOC_DIR" "$skin" "$header.md"
|
|
# done
|
|
#
|
|
# echo "[Cleanup Extra Files Complete]"
|
|
|
|
git_commit_and_push:
|
|
name: Git Commit and Push
|
|
runs-on: danser
|
|
needs:
|
|
- cleanup_extra_files
|
|
- generate_per_skin_docs
|
|
- generate_readme_index
|
|
- create_osk_files
|
|
- convert_png_to_webp
|
|
- generate_mod_icons
|
|
- rename_assets_from_skin_ini
|
|
- generate_videos_and_screenshots
|
|
- prepare_assets
|
|
- detect_changed_skins
|
|
- calculate_git_tag
|
|
if: >-
|
|
always() && (
|
|
(needs.detect_changed_skins.outputs.has_changes == 'true') ||
|
|
(github.event.inputs.soft_run == 'true')
|
|
)
|
|
container:
|
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Download README from generate_readme_index
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: updated-index-readme
|
|
path: .
|
|
|
|
- name: Download README from generate_per_skin_docs
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: updated-per-skin-readme
|
|
path: ./docs/
|
|
|
|
- name: Configure Git
|
|
shell: bash
|
|
run: |
|
|
git config user.email "arlind@sulej.ch"
|
|
git config user.name "ci-bot"
|
|
|
|
- name: Add and Commit changes
|
|
shell: bash
|
|
run: |
|
|
git config advice.addIgnoredFile false
|
|
|
|
for p in docs/ media/gameplay media/thumbnail media/panel media/icons export README.md how-to-use.md src; do
|
|
if [ -e "$p" ]; then
|
|
git add -A "$p"
|
|
fi
|
|
done
|
|
|
|
git commit -m "[ci skip] push back from pipeline" -q || echo "No changes to commit"
|
|
|
|
- name: Push changes and create tag
|
|
shell: bash
|
|
run: |
|
|
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
|
|
git push origin HEAD:main || echo "No changes to push"
|
|
git tag "${{ needs.calculate_git_tag.outputs.new_tag }}"
|
|
git push origin "${{ needs.calculate_git_tag.outputs.new_tag }}"
|
|
else
|
|
git push origin HEAD:"${GITHUB_REF_NAME}" || echo "No changes to push"
|
|
fi
|