Initial commit
This commit is contained in:
33
deploy.sh
Normal file
33
deploy.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIST_DIR="D:/Weby/BOHA Website/New/dist"
|
||||
HTDOCS_DIR="/c/Apache24/htdocs"
|
||||
|
||||
echo "=== BOHA Automation Deploy ==="
|
||||
|
||||
# 1. Build
|
||||
echo "[1/4] Building..."
|
||||
npm run build
|
||||
|
||||
# 2. Verify build
|
||||
if [ ! -f "$DIST_DIR/index.html" ] || [ ! -d "$DIST_DIR/api" ]; then
|
||||
echo "ERROR: Build incomplete - missing index.html or api/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[2/4] Build verified OK"
|
||||
|
||||
# 3. Deploy
|
||||
echo "[3/4] Deploying to Apache..."
|
||||
rm -rf "$HTDOCS_DIR"/*
|
||||
cp -r "$DIST_DIR"/* "$HTDOCS_DIR"/
|
||||
|
||||
# 4. Health check
|
||||
echo "[4/4] Health check..."
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost/ 2>/dev/null || echo "000")
|
||||
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then
|
||||
echo "=== Deploy OK (HTTP $HTTP_CODE) ==="
|
||||
else
|
||||
echo "WARNING: Health check returned HTTP $HTTP_CODE (Apache may not be running)"
|
||||
fi
|
||||
Reference in New Issue
Block a user