feat: add git post-receive hook for auto build and start

Adds a `git_hooks/post-receive` script that runs `pnpm run build:start`
(equivalent to `next build && next start`) automatically after a push is
received, enabling deployment on `receive.denyCurrentBranch=updateInstead`
configured repos (e.g., production/test servers).

Updates the README with a new "Git Hooks" section explaining:

- How to enable the hooks locally via `git config core.hooksPath git_hooks`
- That `core.hooksPath` is a local config and must be set per clone
- That `post-receive` fires on the receiving (push target) machine, not
  the local dev machine
This commit is contained in:
2026-06-12 14:06:41 +08:00
parent d64ad0f130
commit c4fa692528
2 changed files with 33 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# Post-receive hook: push 后自动 build + start
#
# 触发场景:
# - 非 bare repo + receive.denyCurrentBranch=updateInstead:本地推送自动部署
#
# 用途:执行 package.json 中的 `build:start` 脚本
# - 内部 = `npm run build && npm run start`
# - 实际调用 `pnpm run build:start`(项目使用 pnpm
pnpm run build:start