mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
chore: enhance README with new helper variables and add meta.json validation in CI workflow
This commit is contained in:
44
.github/workflows/validate.yml
vendored
44
.github/workflows/validate.yml
vendored
@@ -49,6 +49,50 @@ jobs:
|
|||||||
echo "✅ Blueprint folders validated successfully."
|
echo "✅ Blueprint folders validated successfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Validate meta.json structure and required fields
|
||||||
|
run: |
|
||||||
|
echo "🔍 Validating meta.json structure and required fields..."
|
||||||
|
|
||||||
|
ERROR=0
|
||||||
|
|
||||||
|
# Validate JSON structure and required fields
|
||||||
|
ENTRIES=$(jq -c '.[]' meta.json)
|
||||||
|
INDEX=0
|
||||||
|
while IFS= read -r entry; do
|
||||||
|
((INDEX++))
|
||||||
|
|
||||||
|
# Validate required top-level fields
|
||||||
|
for field in "id" "name" "version" "description" "logo" "links" "tags"; do
|
||||||
|
if [ "$(echo "$entry" | jq "has(\"$field\")")" != "true" ]; then
|
||||||
|
echo "❌ Entry #$INDEX is missing required field: $field"
|
||||||
|
ERROR=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Validate links object required fields
|
||||||
|
if [ "$(echo "$entry" | jq 'has("links")')" == "true" ]; then
|
||||||
|
for link_field in "github" "website" "docs"; do
|
||||||
|
if [ "$(echo "$entry" | jq ".links | has(\"$link_field\")")" != "true" ]; then
|
||||||
|
echo "❌ Entry #$INDEX: links object is missing required field: $link_field"
|
||||||
|
ERROR=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate tags array is not empty
|
||||||
|
if [ "$(echo "$entry" | jq '.tags | length')" -eq 0 ]; then
|
||||||
|
echo "❌ Entry #$INDEX: tags array cannot be empty"
|
||||||
|
ERROR=1
|
||||||
|
fi
|
||||||
|
done <<< "$ENTRIES"
|
||||||
|
|
||||||
|
if [ $ERROR -eq 1 ]; then
|
||||||
|
echo "❌ meta.json structure validation failed."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "✅ meta.json structure validated successfully."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Validate meta.json matches blueprint folders and logo files
|
- name: Validate meta.json matches blueprint folders and logo files
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Validating meta.json against blueprint folders and logos..."
|
echo "🔍 Validating meta.json against blueprint folders and logos..."
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ My content
|
|||||||
"""
|
"""
|
||||||
```
|
```
|
||||||
|
|
||||||
Important: you can reference any variable in the `domains`, `env` and `mounts` sections. just use the `${variable_name}` syntax, in the case you don't want to define a variable, you can use the `domain`, `base64`, `password`, `hash`, `uuid`, `randomPort` or `timestamp` helpers.
|
Important: you can reference any variable in the `domains`, `env` and `mounts` sections. just use the `${variable_name}` syntax, in the case you don't want to define a variable, you can use the `domain`, `base64`, `password`, `hash`, `uuid`, `randomPort`, `timestamp`, `jwt`, `email`, or `username` helpers.
|
||||||
|
|
||||||
### Helpers
|
### Helpers
|
||||||
|
|
||||||
@@ -145,6 +145,8 @@ We have a few helpers that are very common when creating a template, these are:
|
|||||||
- `randomPort`: This is a helper that will generate a random port for the template.
|
- `randomPort`: This is a helper that will generate a random port for the template.
|
||||||
- `timestamp`: This is a helper that will generate a timestamp.
|
- `timestamp`: This is a helper that will generate a timestamp.
|
||||||
- `jwt or jwt:length`: This is a helper that will generate a jwt for the template.
|
- `jwt or jwt:length`: This is a helper that will generate a jwt for the template.
|
||||||
|
- `email`: This is a helper that will generate a random email for the template.
|
||||||
|
- `username`: This is a helper that will generate a random username in lowercase for the template.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user