210053b151
Deploy all examples for each release (canary or stable, but not PRs). Right now we only have one example that we deploy so we don't need to determine which ones changed.
24 lines
827 B
Bash
Executable file
24 lines
827 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
#CHANGED_EXAMPLES=$(node scripts/run-for-change.js --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;
|