2023-03-16 01:01:26 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-08-15 05:23:57 +02:00
|
|
|
#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
|
|
|
|
|
2023-03-16 01:01:26 +01:00
|
|
|
PROD=""
|
|
|
|
if [ "$DEPLOY_ENVIRONMENT" = "production" ]; then
|
|
|
|
PROD="--prod"
|
|
|
|
fi
|
|
|
|
|
2023-03-27 07:26:05 +02:00
|
|
|
if [ -z "$VERCEL_API_TOKEN" ]; then
|
|
|
|
echo "VERCEL_API_TOKEN was not providing, skipping..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-03-16 01:01:26 +01:00
|
|
|
for CWD in $CHANGED_EXAMPLES ; do
|
2023-03-17 04:02:28 +01:00
|
|
|
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
|
2023-03-16 01:01:26 +01:00
|
|
|
done;
|