image checking
This commit is contained in:
32
.github/workflows/check-mod.yml
vendored
32
.github/workflows/check-mod.yml
vendored
@@ -12,13 +12,18 @@ jobs:
|
|||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install ImageMagick
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y imagemagick
|
||||||
|
|
||||||
- name: Check Required Files
|
- name: Check Required Files
|
||||||
run: |
|
run: |
|
||||||
# This for-loop iterates over each directory in mods/
|
|
||||||
# to ensure description.md and meta.json exist.
|
|
||||||
for dir in mods/*/; do
|
for dir in mods/*/; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
MOD_DIR="$(basename "$dir")"
|
MOD_DIR="$(basename "$dir")"
|
||||||
|
|
||||||
|
# Ensure description.md and meta.json exist
|
||||||
if [ ! -f "$dir/description.md" ]; then
|
if [ ! -f "$dir/description.md" ]; then
|
||||||
echo "Error: Missing description.md in $MOD_DIR"
|
echo "Error: Missing description.md in $MOD_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -28,6 +33,29 @@ jobs:
|
|||||||
echo "Error: Missing meta.json in $MOD_DIR"
|
echo "Error: Missing meta.json in $MOD_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Check Thumbnail Dimensions
|
||||||
|
run: |
|
||||||
|
for dir in mods/*/; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
MOD_DIR="$(basename "$dir")"
|
||||||
|
THUMBNAIL="$dir/thumbnail.png"
|
||||||
|
|
||||||
|
if [ -f "$THUMBNAIL" ]; then
|
||||||
|
# Extract width and height using ImageMagick
|
||||||
|
DIMENSIONS=$(identify -format "%wx%h" "$THUMBNAIL")
|
||||||
|
WIDTH=$(echo "$DIMENSIONS" | cut -dx -f1)
|
||||||
|
HEIGHT=$(echo "$DIMENSIONS" | cut -dx -f2)
|
||||||
|
|
||||||
|
# If thumbnail exceeds 1920x500, exit with error
|
||||||
|
if [ "$WIDTH" -gt 1920 ] || [ "$HEIGHT" -gt 500 ]; then
|
||||||
|
echo "Error: Thumbnail in $MOD_DIR exceeds the 1920×500 recommended size."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Validate JSON Format
|
- name: Validate JSON Format
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ This file stores essential metadata in JSON format. **Make sure you adhere to th
|
|||||||
- **downloadURL**: A direct link to the latest version of your released mod. (Can be same as `repo` if no separate download link exists.)
|
- **downloadURL**: A direct link to the latest version of your released mod. (Can be same as `repo` if no separate download link exists.)
|
||||||
|
|
||||||
### 3. thumbnail.png (Optional)
|
### 3. thumbnail.png (Optional)
|
||||||
If included, this image will appear alongside your mod in the index. Recommended size is 512×512 pixels or smaller.
|
If included, this image will appear alongside your mod in the index. Maximum and recommended size is 1920 × 500 pixels.
|
||||||
|
|
||||||
## How to Publish
|
## How to Publish
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user