Files
learning-lab-express/deploy.sh
2026-10-27 23:22:57 +07:00

39 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Deploys Learning Lab Express to Netlify production (https://express.bawana.com).
# The site has no Git integration: it is built here, with .env.production, and the dist folder is uploaded.
#
# ./deploy.sh test, build and deploy to production
# ./deploy.sh --draft same, but to a draft URL for checking first
set -euo pipefail
SITE_ID="574369ce-8199-498e-bb7c-0a19b8684ab2" # Netlify project "lab-express"
cd "$(dirname "$0")"
if ! command -v netlify >/dev/null; then
echo "Netlify CLI not found. Install it with: npm install -g netlify-cli" >&2
exit 1
fi
if [ ! -f .env.production ]; then
echo ".env.production is missing: the build would use the dev Clerk key." >&2
exit 1
fi
if [ -n "$(git status --porcelain -- src index.html package.json package-lock.json netlify.toml)" ]; then
echo "Warning: there are uncommitted changes; they will be deployed too." >&2
fi
echo "› Running tests"
npm test
echo "› Building"
npm run build
MESSAGE="$(git log -1 --pretty='%h %s')"
if [ "${1:-}" = "--draft" ]; then
echo "› Deploying a draft"
netlify deploy --no-build --dir dist --site "$SITE_ID" --message "Draft: $MESSAGE"
else
echo "› Deploying to production"
netlify deploy --prod --no-build --dir dist --site "$SITE_ID" --message "$MESSAGE"
fi