每次更新 docs/ 后,忘记同步到根目录。
创建 deploy.sh:
#!/bin/bash
# 部署脚本 - 必须通过这个脚本部署
echo "🚀 开始部署..."
# 1. 同步 docs 到根目录
cp -r docs/* .
echo "✅ 已同步 docs/ 到根目录"
# 2. 检查关键文件
if [ ! -f "index.html" ]; then
echo "❌ 错误: 根目录缺少 index.html"
exit 1
fi
if [ ! -f "CNAME" ]; then
echo "❌ 错误: 根目录缺少 CNAME"
exit 1
fi
echo "✅ 关键文件检查通过"
# 3. Git 操作
git add -A
git commit -m "Deploy: $(date '+%Y-%m-%d %H:%M')"
git push origin master
echo "✅ 部署完成!等待2-5分钟后刷新网站"
echo "验证命令: curl -sH 'Cache-Control: no-cache' https://chinahospitalsguide.com/ | grep '<title>'"
创建 .github/workflows/sync-docs.yml:
name: Sync docs to root
on:
push:
paths:
- 'docs/**'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cp -r docs/* .
- run: git add -A && git commit -m "Auto-sync docs to root" && git push
deploy.sh 脚本"记录不等于记住,记住不等于执行"
需要把检查清单固化到:
记录日期: 2026-03-16 问题状态: 已临时解决,待根治