mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
refactor: add validation metadata
This commit is contained in:
parent
f190414c1b
commit
7680b8b3c9
36
.github/workflows/validate.yml
vendored
36
.github/workflows/validate.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Validate blueprint folders
|
- name: Validate blueprint folders and files
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Validating blueprints folder structure..."
|
echo "🔍 Validating blueprints folder structure..."
|
||||||
|
|
||||||
@ -49,35 +49,39 @@ jobs:
|
|||||||
echo "✅ Blueprint folders validated successfully."
|
echo "✅ Blueprint folders validated successfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Validate meta.json matches blueprint folders
|
- name: Validate meta.json matches blueprint folders and logo files
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Validating meta.json against blueprint folders..."
|
echo "🔍 Validating meta.json against blueprint folders and logos..."
|
||||||
|
|
||||||
ERROR=0
|
ERROR=0
|
||||||
|
|
||||||
# Read all blueprint folder names into an array
|
# Read all blueprint folder names into an array
|
||||||
FOLDERS=($(ls -1 blueprints))
|
FOLDERS=($(ls -1 blueprints))
|
||||||
|
|
||||||
# Extract ids from meta.json
|
# Extract ids and logos from meta.json
|
||||||
META_IDS=$(jq -r '.[].id' meta.json)
|
IDS_AND_LOGOS=$(jq -c '.[] | {id, logo}' meta.json)
|
||||||
|
|
||||||
# Validate each id in meta.json exists as a folder
|
# Validate each id in meta.json exists as a folder
|
||||||
for ID in $META_IDS; do
|
for item in $IDS_AND_LOGOS; do
|
||||||
FOUND=0
|
ID=$(echo "$item" | jq -r '.id')
|
||||||
for FOLDER in "${FOLDERS[@]}"; do
|
LOGO=$(echo "$item" | jq -r '.logo')
|
||||||
if [ "$ID" == "$FOLDER" ]; then
|
|
||||||
FOUND=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$FOUND" -eq 0 ]; then
|
# Check if folder exists
|
||||||
echo "❌ meta.json id \"$ID\" does not match any folder in blueprints/"
|
if [ ! -d "blueprints/$ID" ]; then
|
||||||
|
echo "❌ meta.json id \"$ID\" does not have a matching folder in blueprints/"
|
||||||
|
ERROR=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if logo file exists inside its folder
|
||||||
|
if [ ! -f "blueprints/$ID/$LOGO" ]; then
|
||||||
|
echo "❌ Logo \"$LOGO\" defined for \"$ID\" does not exist in blueprints/$ID/"
|
||||||
ERROR=1
|
ERROR=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Validate each folder has an entry in meta.json
|
# Validate each folder has a matching id in meta.json
|
||||||
|
META_IDS=$(jq -r '.[].id' meta.json)
|
||||||
for FOLDER in "${FOLDERS[@]}"; do
|
for FOLDER in "${FOLDERS[@]}"; do
|
||||||
FOUND=0
|
FOUND=0
|
||||||
for ID in $META_IDS; do
|
for ID in $META_IDS; do
|
||||||
|
Loading…
Reference in New Issue
Block a user