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:
Executable
+11
@@ -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
|
||||
Reference in New Issue
Block a user