From dc642a33288bac93bb57bf1e46adaa594361d788 Mon Sep 17 00:00:00 2001 From: silverpro89 Date: Wed, 21 Jan 2026 15:17:09 +0700 Subject: [PATCH] update CICD --- .gitea/workflows/deploy.yml | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..d57eb62 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -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 "=========================================="