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,31 +38,39 @@ 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
echo "Push event detected"
# Get the parent commit
PARENT_SHA=$(git rev-parse HEAD^)
CURRENT_SHA=${{ github.sha }} 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 "Changed files:"
echo "$CHANGED_FILES"
# Check for changes in specific directories
if echo "$CHANGED_FILES" | grep -q "^backend/"; then
echo "Backend changes detected" echo "Backend changes detected"
BACKEND="true" BACKEND="true"
fi fi
# Check frontend changes if echo "$CHANGED_FILES" | grep -q "^frontend/"; then
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^frontend/"; then
echo "Frontend changes detected" echo "Frontend changes detected"
FRONTEND="true" FRONTEND="true"
fi fi
fi fi
fi
# Output results # Output results
echo "backend=$BACKEND" >> $GITHUB_OUTPUT echo "backend=$BACKEND" >> $GITHUB_OUTPUT

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,