generated from osc/skins-template
no more clean up
All checks were successful
Generate Skin previews, OSK files and per skin documentation / Full CI/CD Pipeline (push) Successful in 21s
All checks were successful
Generate Skin previews, OSK files and per skin documentation / Full CI/CD Pipeline (push) Successful in 21s
This commit is contained in:
@@ -1,79 +0,0 @@
|
|||||||
name: "Cleanup Extra Files"
|
|
||||||
description: "Remove leftover or outdated assets from repository"
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
all_skins:
|
|
||||||
description: "JSON array of all skins"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Cleanup Extra Files
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
echo "[Cleanup Extra Files Started]"
|
|
||||||
|
|
||||||
readarray -t skins < <(echo '${{ inputs.all_skins }}' | jq -r '.[]')
|
|
||||||
|
|
||||||
[ -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
|
|
||||||
|
|
||||||
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
|
|
||||||
echo " → Removing unexpected root file: $f"
|
|
||||||
rm -f "$f"
|
|
||||||
fi
|
|
||||||
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")
|
|
||||||
|
|
||||||
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]"
|
|
||||||
@@ -102,11 +102,6 @@ jobs:
|
|||||||
readme_path: ${{ env.README_PATH }}
|
readme_path: ${{ env.README_PATH }}
|
||||||
doc_dir: ${{ env.DOC_DIR }}
|
doc_dir: ${{ env.DOC_DIR }}
|
||||||
|
|
||||||
- name: Cleanup Files
|
|
||||||
uses: https://git.sulejmani.xyz/Arlind/skins/.gitea/workflows/actions/cleanup@reusable-actions
|
|
||||||
with:
|
|
||||||
all_skins: ${{ steps.discover.outputs.all_skins }}
|
|
||||||
|
|
||||||
- name: Commit and Push
|
- name: Commit and Push
|
||||||
uses: https://git.sulejmani.xyz/Arlind/skins/.gitea/workflows/actions/git-commit-push@reusable-actions
|
uses: https://git.sulejmani.xyz/Arlind/skins/.gitea/workflows/actions/git-commit-push@reusable-actions
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user