Test CI
This commit is contained in:
@@ -26,32 +26,51 @@ jobs:
|
||||
|
||||
- name: Check for changed files
|
||||
id: filter
|
||||
shell: bash # Explicitly specify bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
# If manually triggered, build both
|
||||
echo "backend=true" >> $GITHUB_OUTPUT
|
||||
echo "frontend=true" >> $GITHUB_OUTPUT
|
||||
elif [ "${{ github.ref }}" = refs/tags/* ]; then
|
||||
# If it's a tag, build both
|
||||
echo "backend=true" >> $GITHUB_OUTPUT
|
||||
echo "frontend=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# Check which directories have changes
|
||||
git fetch origin main
|
||||
echo "Checking for changes..."
|
||||
|
||||
if git diff --name-only origin/main..HEAD | grep -q "^backend/"; then
|
||||
echo "backend=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "backend=false" >> $GITHUB_OUTPUT
|
||||
# Initialize outputs
|
||||
BACKEND="false"
|
||||
FRONTEND="false"
|
||||
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "Workflow manually triggered - building both"
|
||||
BACKEND="true"
|
||||
FRONTEND="true"
|
||||
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo "Tag detected - building both"
|
||||
BACKEND="true"
|
||||
FRONTEND="true"
|
||||
else
|
||||
echo "Checking changed files between main and current commit..."
|
||||
|
||||
# Get the base ref for the comparison
|
||||
BASE_SHA=$(git rev-parse origin/main)
|
||||
CURRENT_SHA=${{ github.sha }}
|
||||
|
||||
echo "Comparing $BASE_SHA...$CURRENT_SHA"
|
||||
|
||||
# Check backend changes
|
||||
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^backend/"; then
|
||||
echo "Backend changes detected"
|
||||
BACKEND="true"
|
||||
fi
|
||||
|
||||
if git diff --name-only origin/main..HEAD | grep -q "^frontend/"; then
|
||||
echo "frontend=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "frontend=false" >> $GITHUB_OUTPUT
|
||||
# Check frontend changes
|
||||
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^frontend/"; then
|
||||
echo "Frontend changes detected"
|
||||
FRONTEND="true"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Output results
|
||||
echo "backend=$BACKEND" >> $GITHUB_OUTPUT
|
||||
echo "frontend=$FRONTEND" >> $GITHUB_OUTPUT
|
||||
|
||||
# Debug output
|
||||
echo "Debug: Backend will build: $BACKEND"
|
||||
echo "Debug: Frontend will build: $FRONTEND"
|
||||
|
||||
|
||||
build-backend:
|
||||
needs: changes
|
||||
@@ -60,7 +79,6 @@ jobs:
|
||||
container:
|
||||
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
# Rest of your backend job...
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user