Add deploy.sh for Netlify production deploys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Iqbal
2026-10-27 23:22:57 +07:00
parent 6f3a5234b4
commit 844c88912a
2 changed files with 39 additions and 0 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@ node_modules
dist dist
.env .env
.env.local .env.local
.netlify

38
deploy.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/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