Files
vercel__next.js/scripts/deploy-examples.sh
T
Hendrik Liebau 5c045fb2f4 [ci] Improve change detection logic in run-for-change script (#85619)
This PR extracts the existing git change detection logic from the `get-changed-tests` script into a separate module. This allows reusing the same logic in the `run-for-change` script, ensuring consistent behavior across the two scripts to determine changed files. Specifically, this ensures that in stacked PRs, the docs-only change detection (and the test-only change detection in the upstack PR) works correctly by diffing against the appropriate base branch.
2025-10-31 18:10:03 +01:00

25 lines
828 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
#CHANGED_EXAMPLES=$(node scripts/run-for-change.mjs --type deploy-examples --listChangedDirectories)
##### TODO: fix the script above so it can work for stable releases which reach back multiple commits
CHANGED_EXAMPLES="examples/image-component" # always deploy as a workaround
PROD=""
if [ "$DEPLOY_ENVIRONMENT" = "production" ]; then
PROD="--prod"
fi
if [ -z "$VERCEL_API_TOKEN" ]; then
echo "VERCEL_API_TOKEN was not providing, skipping..."
exit 0
fi
for CWD in $CHANGED_EXAMPLES ; do
HYPHENS=$(echo "$CWD" | tr '/' '-')
PROJECT="nextjs-$HYPHENS"
echo "Deploying directory $CWD as $PROJECT to Vercel..."
vercel link --cwd "$CWD" --scope vercel --project "$PROJECT" --token "$VERCEL_API_TOKEN" --yes
vercel deploy --cwd "$CWD" --token "$VERCEL_API_TOKEN" $PROD
done;