diff --git a/web/DEPLOY.md b/web/DEPLOY.md index 45c03e2..f0abd50 100644 --- a/web/DEPLOY.md +++ b/web/DEPLOY.md @@ -65,6 +65,10 @@ When Workers Builds can't run, `npm run deploy` does the same as a build: it applies the D1 migrations, then deploys. Code that expects a migration fails on every page until that migration has run. +The footer shows the deployed commit only when the working tree is clean: +with uncommitted changes there is no commit to link to. A bare +`npx wrangler deploy` shows no version. + ## Rolling back - Code: `npx wrangler rollback` (or pick a version under Workers → Deployments). diff --git a/web/package.json b/web/package.json index af20bd7..cb36f30 100644 --- a/web/package.json +++ b/web/package.json @@ -11,7 +11,7 @@ "db:migrate:local": "wrangler d1 migrations apply nodebox-forum --local", "db:migrate:remote": "wrangler d1 migrations apply nodebox-forum --remote", "db:seed:local": "wrangler d1 execute nodebox-forum --local --file seed/dev.sql", - "deploy": "npm run build:client && npm run db:migrate:remote && wrangler deploy", + "deploy": "npm run build:client && npm run db:migrate:remote && wrangler deploy --var GIT_COMMIT:$(git diff --quiet HEAD && git rev-parse HEAD || echo none)", "secrets": "sh scripts/put-secrets.sh", "ci:build": "npm run typecheck && npm test && npm run build:client", "ci:deploy": "wrangler d1 migrations apply nodebox-forum --remote && wrangler deploy --var GIT_COMMIT:${WORKERS_CI_COMMIT_SHA:-none}",