Files
urukprize/backend/deploy.sh
T

49 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# ==============================================================================
# Uruk International Prize - Deploy & Git Sync Script
# Developed for: Hamza Ayed (Founding Tech Architect)
# ==============================================================================
set -e
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}======================================================${NC}"
echo -e "${BLUE} 🚀 Uruk Prize Platform - Deploy & Sync Pipeline ${NC}"
echo -e "${BLUE}======================================================${NC}"
# Check if git is initialized
if [ ! -d ".git" ] && [ ! -d "../.git" ]; then
echo -e "${YELLOW}⚡ Initializing local Git repository...${NC}"
git init
fi
# 1. Staging changes
echo -e "${BLUE}[1/4] Staging files...${NC}"
git add -A
# 2. Committing with message or auto-timestamp
COMMIT_MSG=${1:-"Update Uruk Prize Core & Security Layer - $(date '+%Y-%m-%d %H:%M:%S')"}
echo -e "${BLUE}[2/4] Committing: ${YELLOW}'$COMMIT_MSG'${NC}"
git commit -m "$COMMIT_MSG" || echo -e "${YELLOW}No changes to commit.${NC}"
# 3. Pushing to Remote Git Repository
echo -e "${BLUE}[3/4] Pushing to Git remote...${NC}"
if git remote | grep -q 'origin'; then
git push origin main || git push origin master
echo -e "${GREEN}✓ Successfully pushed to remote Git.${NC}"
else
echo -e "${YELLOW}⚠️ No remote 'origin' set yet. Run: git remote add origin <url>${NC}"
fi
# 4. Server Sync instructions / trigger
echo -e "${BLUE}[4/4] Remote Server Synchronization...${NC}"
echo -e "${GREEN}✓ Local changes committed and ready for server pull.${NC}"
echo -e "${BLUE}On your server, run:${NC}"
echo -e " cd /path/to/uruk-prize && git pull origin main && composer install --no-dev --optimize-autoloader"
echo -e "${GREEN}======================================================${NC}"