Update .gitea/workflows/deploy.yml
All checks were successful
Deploy to Production / deploy (push) Successful in 5s

This commit is contained in:
2026-01-29 03:58:21 +00:00
parent e41ee7fde7
commit 2f114ff840

View File

@@ -20,6 +20,17 @@ jobs:
echo "📁 Current directory: $(pwd)" echo "📁 Current directory: $(pwd)"
echo "📁 GITHUB_WORKSPACE: $GITHUB_WORKSPACE" echo "📁 GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
# Read game info from readme.md
if [ -f "$GITHUB_WORKSPACE/readme.md" ]; then
GAME_TITLE=$(sed -n '1p' "$GITHUB_WORKSPACE/readme.md")
GAME_DESC=$(sed -n '2p' "$GITHUB_WORKSPACE/readme.md")
GAME_TYPE=$(sed -n '3p' "$GITHUB_WORKSPACE/readme.md")
else
GAME_TITLE="Untitled Game"
GAME_DESC="No description"
GAME_TYPE="quiz"
fi
# Create base directory # Create base directory
mkdir -p /var/www/html/games/ mkdir -p /var/www/html/games/
@@ -44,11 +55,30 @@ jobs:
echo "📦 Deploying: $folder_name" echo "📦 Deploying: $folder_name"
rsync -av --delete "$folder" "/var/www/html/games/$folder_name/" rsync -av --delete "$folder" "/var/www/html/games/$folder_name/"
DEPLOYED_FOLDERS="$DEPLOYED_FOLDERS $folder_name" DEPLOYED_FOLDERS="$DEPLOYED_FOLDERS $folder_name"
DEPLOYED_URLS="$DEPLOYED_URLS\n 🔗 https://senaai.tech/games/$folder_name/" GAME_URL="https://senaai.tech/games/$folder_name/"
DEPLOYED_URLS="$DEPLOYED_URLS\n 🔗 $GAME_URL"
# Get thumbnail (first image found or default)
THUMBNAIL=$(find "$folder" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) 2>/dev/null | head -n 1 || true)
if [ -z "$THUMBNAIL" ]; then
THUMBNAIL="https://senaai.tech/games/$folder_name/images/default.png"
else
THUMBNAIL="https://senaai.tech/games/$folder_name/$(basename "$THUMBNAIL")"
fi
# Submit game info to API
echo "📤 Submitting game info to API..."
curl --location 'http://senaai.tech:10000/api/games/save-with-check' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode "title=$GAME_TITLE" \
--data-urlencode "description=$GAME_DESC" \
--data-urlencode "url=$GAME_URL" \
--data-urlencode "thumbnail=$THUMBNAIL" \
--data-urlencode "type=$GAME_TYPE" || true
echo ""
done done
# Clear console and show only deployment summary # Show deployment summary
clear
echo "" echo ""
echo "==========================================" echo "=========================================="
echo "🎉 Deployment Completed Successfully!" echo "🎉 Deployment Completed Successfully!"