From 9f72c263a6945fe90899f85f732c0866c7f61b25 Mon Sep 17 00:00:00 2001 From: Innei Date: Sat, 26 Oct 2024 17:34:05 +0800 Subject: [PATCH] fix(ci): windows build Signed-off-by: Innei --- .../{build:web.yml => build-web.yml} | 0 scripts/skip-ssr-app-vercel-build.sh | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+) rename .github/workflows/{build:web.yml => build-web.yml} (100%) create mode 100644 scripts/skip-ssr-app-vercel-build.sh diff --git a/.github/workflows/build:web.yml b/.github/workflows/build-web.yml similarity index 100% rename from .github/workflows/build:web.yml rename to .github/workflows/build-web.yml diff --git a/scripts/skip-ssr-app-vercel-build.sh b/scripts/skip-ssr-app-vercel-build.sh new file mode 100644 index 0000000000..5feb072439 --- /dev/null +++ b/scripts/skip-ssr-app-vercel-build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +LAST_DEPLOY_COMMIT=$(git rev-parse HEAD^) + +CHANGED_FILES=$(git diff --name-only $LAST_DEPLOY_COMMIT HEAD) + +# Define an array of paths and files to check +CHECK_PATHS_AND_FILES=("apps/server/" "packages/" "package.json" "pnpm-lock.yaml") + +ONLY_SERVER_OR_PACKAGES_CHANGES=true +for file in $CHANGED_FILES; do + MATCH_FOUND=false + for path in "${CHECK_PATHS_AND_FILES[@]}"; do + if [[ $file == $path* ]]; then + MATCH_FOUND=true + break + fi + done + if [ "$MATCH_FOUND" = false ]; then + ONLY_SERVER_OR_PACKAGES_CHANGES=false + break + fi +done + +if [ "$ONLY_SERVER_OR_PACKAGES_CHANGES" = true ]; then + echo "continue" + echo "Changed files: $CHANGED_FILES" + exit 1 +else + echo "skip" + exit +fi