This commit is contained in:
60
.gitea/workflows/deploy.yml
Normal file
60
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Deploy to Production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Deploy to server
|
||||
run: |
|
||||
echo "🚀 Deploying to /var/www/html/games"
|
||||
echo "📁 Current directory: $(pwd)"
|
||||
echo "📁 GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
|
||||
|
||||
# Create base directory
|
||||
mkdir -p /var/www/html/games/
|
||||
|
||||
# Find and deploy all game folders (exclude source, .git, .gitea, etc.)
|
||||
DEPLOYED_FOLDERS=""
|
||||
DEPLOYED_URLS=""
|
||||
for folder in $GITHUB_WORKSPACE/*/; do
|
||||
folder_name=$(basename "$folder")
|
||||
|
||||
# Skip excluded folders
|
||||
if [[ "$folder_name" == "source" ]] || \
|
||||
[[ "$folder_name" == ".git" ]] || \
|
||||
[[ "$folder_name" == ".gitea" ]] || \
|
||||
[[ "$folder_name" == "node_modules" ]] || \
|
||||
[[ "$folder_name" == "logs" ]] || \
|
||||
[[ "$folder_name" == "uploads" ]]; then
|
||||
echo "⏭️ Skipping: $folder_name"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Deploy the folder
|
||||
echo "📦 Deploying: $folder_name"
|
||||
rsync -av --delete "$folder" "/var/www/html/games/$folder_name/"
|
||||
DEPLOYED_FOLDERS="$DEPLOYED_FOLDERS $folder_name"
|
||||
DEPLOYED_URLS="$DEPLOYED_URLS\n 🔗 https://senaai.tech/games/$folder_name/"
|
||||
done
|
||||
|
||||
# Clear console and show only deployment summary
|
||||
clear
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "🎉 Deployment Completed Successfully!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "📍 Deployed URLs:"
|
||||
echo -e "$DEPLOYED_URLS"
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
Reference in New Issue
Block a user