Merge pull request #11 from qinfendebingshuo/copilot/test-cd-automation

Fix deployment blockers: broken submodule, push race conditions, remote rsync
This commit is contained in:
冰朔 2026-03-07 18:24:38 +08:00 committed by GitHub
commit 08c91e15a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 90 additions and 7 deletions

View File

@ -89,6 +89,13 @@ jobs:
- name: 📥 检出代码
uses: actions/checkout@v4
- name: 📦 确保本地 rsync 已安装
run: |
if ! command -v rsync &>/dev/null; then
sudo apt-get update -qq && sudo apt-get install -y rsync
fi
rsync --version | head -1
- name: 🔑 配置 SSH 连接
run: |
mkdir -p ~/.ssh
@ -96,6 +103,18 @@ jobs:
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
- name: 📦 确保远程服务器 rsync 已安装
run: |
echo "🔍 检查远程服务器 rsync..."
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"command -v rsync || { echo '⚠️ 远程服务器未安装 rsync尝试安装...' && \
(sudo apt-get update -qq && sudo apt-get install -y rsync 2>/dev/null || \
sudo yum install -y rsync 2>/dev/null || \
{ echo '❌ 无法自动安装 rsync可能缺少 sudo 权限)'; \
echo '请手动在服务器上安装: sudo apt-get install rsync 或 sudo yum install rsync'; \
exit 1; }); }"
echo "✅ 远程服务器 rsync 检查完成"
- name: 🔒 部署前安全检查
run: |
if [ ! -f "docs/index.html" ]; then

View File

@ -49,7 +49,12 @@ jobs:
echo "📋 文档无变化,跳过提交"
else
git commit -m "📋 自动更新 HoloLake Era 模块文档 · $(date -u +%Y-%m-%d\ %H:%M\ UTC)"
git push
git pull --rebase origin main || echo "⚠️ rebase 失败(可能有冲突),尝试直接推送..."
git push || {
echo "⚠️ 推送失败,尝试重新拉取后再推送..."
git pull --rebase origin main
git push
}
fi
notify-collaborator:

View File

@ -34,4 +34,10 @@ jobs:
git config user.email "zhuyuan@guanghulab.com"
git add .github/brain/repo-map.json .github/brain/repo-snapshot.md
git diff --cached --quiet || git commit -m "📚 铸渊图书馆目录更新 · $(date +%Y-%m-%dT%H:%M)"
git push
# 拉取远端最新更改后再推送,避免竞态条件
git pull --rebase origin main || echo "⚠️ rebase 失败(可能有冲突),尝试直接推送..."
git push || {
echo "⚠️ 推送失败,尝试重新拉取后再推送..."
git pull --rebase origin main
git push
}

View File

@ -4,12 +4,19 @@
## 一、网址
铸渊聊天室部署在 GitHub Pages 上,**正确网址**
铸渊聊天室部署在 GitHub Pages 上,通过自定义域名访问
```
https://guanghulab.com/
```
备用网址GitHub Pages 默认):
```
https://qinfendebingshuo.github.io/guanghulab/
```
> 💡 两个网址指向同一个网站。`guanghulab.com` 通过 `docs/CNAME` 配置,由 GitHub Pages 提供服务。
>
> ⚠️ 旧网址 `…/docs/index.html` 已失效(系统重构后路径变了),请用上面的新网址。
打开后你会看到铸渊助手的登录界面v5.0),有两种登录方式:
@ -45,9 +52,35 @@ https://qinfendebingshuo.github.io/guanghulab/
## 三、如何部署新版本到网站(⭐ 重要)
铸渊聊天室网站通过 GitHub Actions 自动部署。**只要代码合并到 `main` 分支,网站就会自动更新**。
铸渊聊天室网站通过 GitHub Actions 自动部署。**只要代码合并到 `main` 分支,guanghulab.com 就会自动更新**。
### 方法一:合并 PR推荐
> ### 🎯 快速回答guanghulab.com 合并 PR 就能部署吗?
>
> **是的,合并 PR 就行。** guanghulab.com 由 GitHub Pages 提供服务,合并后 1-3 分钟自动更新。
>
> ```
> 合并 PR → GitHub Actions 自动部署1-3分钟→ 刷新 guanghulab.com 看到新版本
> ```
>
> **完整自动部署流程:**
> ```
> 代码推送到功能分支
> ↓ 自动触发
> Staging 预演检查(模块完整性、安全检查)
> ↓ 检查通过
> PR 等待冰朔合并
> ↓ 冰朔点击 "Merge pull request"(唯一手动步骤)
> GitHub Actions 自动触发:
> ├── 🌀 GitHub Pages 部署 → guanghulab.com 更新
> ├── 🚀 CD 服务器部署(状态看板同步)
> ├── 📚 图书馆目录自动更新
> ├── 📋 模块文档自动生成
> └── 📡 Notion 部署通知
> ↓ 1-3 分钟后
> guanghulab.com 自动更新完成 ✅
> ```
### 方法一:合并 PR推荐 · 唯一需要手动操作的步骤)
当 Copilot Agent 或开发者在功能分支(如 `copilot/xxx`)上完成修改后:
@ -131,8 +164,24 @@ https://qinfendebingshuo.github.io/guanghulab/
## 五、常见问题
### Q: guanghulab.com 合并 PR 就能自动部署吗?
- **是的。** `guanghulab.com` 由 GitHub Pages 提供服务(通过 `docs/CNAME` 配置)
- 合并 PR 到 main 后,`deploy-pages.yml` 自动将 `docs/` 部署到 GitHub Pages
- GitHub Pages 自动为 `guanghulab.com` 域名提供服务
- **1-3 分钟后刷新 guanghulab.com 即可看到新版本**
### Q: 什么时候能看到新模块/新版本上线?
- **PR 合并到 main 后 1-3 分钟**即可看到新版本
- 如果代码还在功能分支PR 未合并),网站不会更新
- 合并后刷新 `https://guanghulab.com/` 即可
### Q: 我还需要手动操作什么吗?
- **只需要一步:合并 PR**(点击绿色的 "Merge pull request" 按钮)
- 部署、通知、文档更新全部自动完成,无需其他操作
- 如果部署后有问题,可以在 Issue 中评论「启动冰朔人格体」进行自动诊断
### Q: 铸渊聊天室打不开?
- 确认网址正确:`https://qinfendebingshuo.github.io/guanghulab/`
- 确认网址正确:`https://guanghulab.com/` 或 `https://qinfendebingshuo.github.io/guanghulab/`
- 不要在后面加 `/docs/index.html`
- 等几分钟再刷新(部署有延迟)
- 按 `Ctrl+Shift+R` 强制刷新,清除缓存

@ -1 +0,0 @@
Subproject commit 4c5dc4e8be2bcba1acee37c1bf93e18372ae4795

View File

@ -0,0 +1,5 @@
# M18 系统健康检查
- 负责人:待分配
- 状态:规划中
- 技术栈:待定
- 依赖模块:无