Fix CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 6s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped

This commit is contained in:
2025-02-27 17:46:53 +01:00
parent 7fbe5e56fb
commit 97efa03c88
2 changed files with 24 additions and 16 deletions

View File

@@ -38,29 +38,37 @@ jobs:
echo "Workflow manually triggered - building both" echo "Workflow manually triggered - building both"
BACKEND="true" BACKEND="true"
FRONTEND="true" FRONTEND="true"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then elif [ "${{ github.ref }}" = refs/tags/* ]; then
echo "Tag detected - building both" echo "Tag detected - building both"
BACKEND="true" BACKEND="true"
FRONTEND="true" FRONTEND="true"
else else
echo "Checking changed files between main and current commit..." echo "Checking changed files..."
# Get the base ref for the comparison # For push events, compare with the parent commit
BASE_SHA=$(git rev-parse origin/main) if [ "${{ github.event_name }}" = "push" ]; then
CURRENT_SHA=${{ github.sha }} echo "Push event detected"
# Get the parent commit
PARENT_SHA=$(git rev-parse HEAD^)
CURRENT_SHA=${{ github.sha }}
echo "Comparing $BASE_SHA...$CURRENT_SHA" echo "Comparing parent ${PARENT_SHA} with current ${CURRENT_SHA}"
# Check backend changes # List all changed files
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^backend/"; then CHANGED_FILES=$(git diff --name-only ${PARENT_SHA} ${CURRENT_SHA})
echo "Backend changes detected" echo "Changed files:"
BACKEND="true" echo "$CHANGED_FILES"
fi
# Check frontend changes # Check for changes in specific directories
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^frontend/"; then if echo "$CHANGED_FILES" | grep -q "^backend/"; then
echo "Frontend changes detected" echo "Backend changes detected"
FRONTEND="true" BACKEND="true"
fi
if echo "$CHANGED_FILES" | grep -q "^frontend/"; then
echo "Frontend changes detected"
FRONTEND="true"
fi
fi fi
fi fi

View File

@@ -8,7 +8,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.info(f"Starting app!!!") logger.info(f"Starting app!")
app = FastAPI( app = FastAPI(
title=settings.PROJECT_NAME, title=settings.PROJECT_NAME,
version=settings.VERSION, version=settings.VERSION,