forked from BLC/AyposWeb
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -36,3 +36,4 @@ yarn-error.log*
|
|||||||
# TypeScript
|
# TypeScript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
node_modules
|
node_modules
|
||||||
|
deploy.sh
|
||||||
|
|||||||
45
deploy.sh
45
deploy.sh
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
cd /home/ubuntu/Bgreen/AyposWeb
|
|
||||||
|
|
||||||
echo "Fetching latest changes from origin/main..."
|
|
||||||
git fetch origin main
|
|
||||||
|
|
||||||
CHANGED_FILES=$(git diff --name-only HEAD origin/main || true)
|
|
||||||
|
|
||||||
if [ -z "$CHANGED_FILES" ]; then
|
|
||||||
echo "No file changes detected."
|
|
||||||
else
|
|
||||||
echo "Changed files:"
|
|
||||||
echo "$CHANGED_FILES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
git reset --hard origin/main
|
|
||||||
|
|
||||||
FRONTEND_CHANGED=false
|
|
||||||
|
|
||||||
if echo "$CHANGED_FILES" | grep -qv "README\.md$"; then
|
|
||||||
FRONTEND_CHANGED=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$FRONTEND_CHANGED" = true ]; then
|
|
||||||
echo "Frontend changes detected."
|
|
||||||
|
|
||||||
if echo "$CHANGED_FILES" | grep -qE "^(package\.json|package-lock\.json)$"; then
|
|
||||||
echo "Package files changed. Running npm install and build..."
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
else
|
|
||||||
echo "Only code changes detected. Running build..."
|
|
||||||
npm run build
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
echo "Rebuilding frontend container..."
|
|
||||||
docker compose up -d --build aypos-frontend
|
|
||||||
else
|
|
||||||
echo "No frontend changes."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Deployment complete."
|
|
||||||
Reference in New Issue
Block a user