mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
5c045fb2f4
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.
25 lines
828 B
Bash
Executable File
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;
|