@@ -63,35 +63,44 @@ jobs:
6363 keys :
6464 - ui-bundle-v1-{{ checksum "ui/package-lock.json" }}-{{ checksum "ui/gulpfile.js" }}
6565 - ui-bundle-v1-{{ checksum "ui/package-lock.json" }}
66- - ui-bundle-v1-
6766 - run :
6867 name : Check if UI rebuild needed
6968 command : |
7069 set -e
7170 echo "[INFO] Checking if UI rebuild is necessary..."
7271
73- # Check if UI bundle exists from cache
74- if [ -f "ui-bundle.zip " ]; then
75- echo "[INFO] UI bundle found in cache "
76-
77- # Determine base branch for comparison
78- if [ "${CIRCLE_BRANCH}" = " main" ]; then
79- BASE_REF="HEAD~1 "
80- echo "[INFO] On main branch, comparing against HEAD~1"
81- else
82- BASE_REF="origin/main"
83- echo "[INFO] On feature branch, comparing against origin/main "
84- fi
72+ # Determine base branch for comparison
73+ if [ "${CIRCLE_BRANCH}" = "main " ]; then
74+ BASE_REF="HEAD~1 "
75+ echo "[INFO] On main branch, comparing against HEAD~1"
76+ else
77+ BASE_REF="origin/ main"
78+ echo "[INFO] On feature branch, comparing against origin/main "
79+ fi
80+
81+ # Check for dependency file changes (forces full UI rebuild)
82+ DEPENDENCY_FILES="package.json package-lock.json ui/package.json ui/package-lock.json "
83+ DEPENDENCY_CHANGED=false
8584
86- # Check if ui/ directory has changes
87- if git diff --quiet $BASE_REF HEAD -- ui/; then
88- echo "[INFO] No UI changes detected, skipping UI rebuild"
89- echo "export SKIP_UI_BUILD=true" >> $BASH_ENV
90- else
91- echo "[INFO] UI changes detected, will rebuild UI bundle"
85+ for file in $DEPENDENCY_FILES; do
86+ if ! git diff --quiet $BASE_REF HEAD -- "$file" 2>/dev/null; then
87+ echo "[INFO] Dependency file changed: $file"
88+ DEPENDENCY_CHANGED=true
9289 fi
93- else
90+ done
91+
92+ if [ "$DEPENDENCY_CHANGED" = true ]; then
93+ echo "[INFO] Dependency changes detected, forcing UI rebuild"
94+ echo "export SKIP_UI_BUILD=false" >> $BASH_ENV
95+ elif [ ! -f "ui-bundle.zip" ]; then
9496 echo "[INFO] No cached UI bundle found, will build UI"
97+ echo "export SKIP_UI_BUILD=false" >> $BASH_ENV
98+ elif git diff --quiet $BASE_REF HEAD -- ui/; then
99+ echo "[INFO] No UI changes detected, skipping UI rebuild"
100+ echo "export SKIP_UI_BUILD=true" >> $BASH_ENV
101+ else
102+ echo "[INFO] UI changes detected, will rebuild UI bundle"
103+ echo "export SKIP_UI_BUILD=false" >> $BASH_ENV
95104 fi
96105 - run :
97106 name : Build UI bundle (conditional)
0 commit comments