From 729cf81395cb9e24bbf019b4e703c969177d4877 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Wed, 20 Aug 2025 12:53:43 +0300 Subject: [PATCH] chore(docs): fix ignore build script (#13248) --- www/ignore-build-script.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/www/ignore-build-script.sh b/www/ignore-build-script.sh index af5dfbd0c4..2d24a3b087 100644 --- a/www/ignore-build-script.sh +++ b/www/ignore-build-script.sh @@ -20,7 +20,15 @@ diffResult=$? echo "DIFF RESULT (www): $diffResult" -# For preview environments, also check project-specific directories + +# Check for production build condition before preview checks +if [[ "$VERCEL_ENV" == "production" && $diffResult -eq 1 ]] ; then + # Proceed with the build for production with changes + echo "✅ - Build can proceed (production with changes)" + exit 1; +fi + +# For preview environments, check project-specific directories if [[ "$VERCEL_ENV" == "preview" && -n "$PROJECT_NAME" ]]; then # Check for changes in the specific project directory PROJECT_DIR="${SCRIPT_DIR}/apps/${PROJECT_NAME}" @@ -50,18 +58,14 @@ if [[ "$VERCEL_ENV" == "preview" && -n "$PROJECT_NAME" ]]; then previewShouldBuild=1 fi echo "PREVIEW SHOULD BUILD: $previewShouldBuild" + + if [[ $previewShouldBuild -eq 1 ]]; then + # Proceed with the build for preview if there are changes in project or packages directory + echo "✅ - Build can proceed (preview with project/packages changes)" + exit 1; + fi fi -if [[ ("$VERCEL_ENV" == "production" && $diffResult -eq 1) || "$VERCEL_GIT_COMMIT_REF" = "docs/"* ]] ; then - # Proceed with the build for production with changes or docs branches - echo "✅ - Build can proceed (production with changes or docs branch)" - exit 1; -elif [[ "$VERCEL_ENV" == "preview" && -n "$PROJECT_NAME" && $previewShouldBuild -eq 1 ]]; then - # Proceed with the build for preview if there are changes in project or packages directory - echo "✅ - Build can proceed (preview with project/packages changes)" - exit 1; -else - # Don't build - echo "🛑 - Build cancelled: Conditions don't match" - exit 0; -fi \ No newline at end of file +# Don't build +echo "🛑 - Build cancelled: Conditions don't match" +exit 0; \ No newline at end of file