Files
cozsweet-frontend-nextjs/git_hooks/post-receive
T
admin c4fa692528 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
2026-06-12 14:06:41 +08:00

12 lines
365 B
Bash
Executable File
Raw 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.
#!/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