1350
This commit is contained in:
1 parent
8f1fffe141
commit
f9076df6e8
4 files changed
+164
-1
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# 安装 Git Hook 脚本
|
||||
# 用法: ./scripts/install-hooks.sh
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
GIT_HOOKS_DIR="$REPO_ROOT/.git/hooks"
|
||||
|
||||
echo ""
|
||||
echo "==================================="
|
||||
echo " 安装 Git Hooks"
|
||||
echo "==================================="
|
||||
echo ""
|
||||
|
||||
# 确保 hooks 目录存在
|
||||
mkdir -p "$GIT_HOOKS_DIR"
|
||||
|
||||
# 复制 post-merge hook
|
||||
if [ -f "$SCRIPT_DIR/post-merge" ]; then
|
||||
cp "$SCRIPT_DIR/post-merge" "$GIT_HOOKS_DIR/post-merge"
|
||||
chmod +x "$GIT_HOOKS_DIR/post-merge"
|
||||
echo "✓ 已安装 post-merge hook"
|
||||
else
|
||||
echo "✗ 未找到 post-merge 脚本"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "==================================="
|
||||
echo " 安装完成!"
|
||||
echo "==================================="
|
||||
echo ""
|
||||
echo "现在在项目根目录执行 git pull 时,"
|
||||
echo "如果 write-server 有更新,会自动触发 Docker 构建。"
|
||||
echo ""
|
||||
echo "手动执行部署:"
|
||||
echo " cd $REPO_ROOT/write-server"
|
||||
echo " ./deploy.sh"
|
||||
echo ""
|
||||
Reference in new issue
Block a user