Skip to content

Commit 39b11b4

Browse files
committed
add docs, blog, workflow
1 parent 16e62d8 commit 39b11b4

66 files changed

Lines changed: 12300 additions & 4083 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# 自动化Build工作流设置指南
2+
3+
## 概述
4+
5+
此项目已配置了GitHub Actions工作流,可以在每次commit后自动触发build,并在推送到main分支时自动部署到GitHub Pages。
6+
7+
## 工作流配置
8+
9+
### 1. 主部署工作流 (`.github/workflows/deploy.yml`)
10+
11+
**触发条件:**
12+
- 推送到 `main` 分支时自动触发build和部署
13+
- 创建到 `main` 分支的Pull Request时仅触发build测试
14+
- 支持手动触发
15+
16+
**功能:**
17+
- 自动安装依赖
18+
- 构建Astro项目
19+
- 部署到GitHub Pages (仅限main分支)
20+
21+
### 2. Build测试工作流 (`.github/workflows/build-test.yml`)
22+
23+
**触发条件:**
24+
- 推送到除 `main` 以外的任何分支
25+
- 创建任何Pull Request
26+
27+
**功能:**
28+
- 验证代码可以成功构建
29+
- 检查构建输出
30+
- 提供快速反馈
31+
32+
## 使用方法
33+
34+
### 基本工作流程
35+
36+
1. **开发分支工作:**
37+
```bash
38+
git checkout -b feature/new-feature
39+
# 进行代码修改
40+
git add .
41+
git commit -m "Add new feature"
42+
git push origin feature/new-feature
43+
```
44+
→ 自动触发build测试
45+
46+
2. **创建Pull Request:**
47+
- 在GitHub上创建PR到main分支
48+
→ 自动触发build测试
49+
50+
3. **合并到main分支:**
51+
```bash
52+
git checkout main
53+
git merge feature/new-feature
54+
git push origin main
55+
```
56+
→ 自动触发build和部署
57+
58+
### GitHub Pages设置
59+
60+
要启用自动部署,需要在GitHub仓库中设置:
61+
62+
1. 进入仓库的 `Settings``Pages`
63+
2.`Source` 中选择 `GitHub Actions`
64+
3. 保存设置
65+
66+
## 工作流状态
67+
68+
你可以在以下位置查看工作流状态:
69+
- GitHub仓库的 `Actions` 标签页
70+
- Pull Request页面的检查状态
71+
- 每次commit旁边的状态图标
72+
73+
## 本地开发
74+
75+
在本地开发时,你仍然可以使用常规命令:
76+
77+
```bash
78+
cd mofa-website
79+
npm install
80+
npm run dev # 开发服务器
81+
npm run build # 构建项目
82+
npm run preview # 预览构建结果
83+
```
84+
85+
## 故障排除
86+
87+
### 如果build失败:
88+
1. 检查GitHub Actions的错误日志
89+
2. 确保本地 `npm run build` 可以成功执行
90+
3. 检查依赖是否正确安装
91+
4. 确认Node.js版本兼容性
92+
93+
### 如果部署失败:
94+
1. 确认GitHub Pages已正确配置
95+
2. 检查仓库权限设置
96+
3. 验证workflow文件语法是否正确
97+
98+
## 自定义配置
99+
100+
如需修改工作流配置,编辑以下文件:
101+
- `.github/workflows/deploy.yml` - 主部署工作流
102+
- `.github/workflows/build-test.yml` - Build测试工作流
103+
104+
常见自定义选项:
105+
- 修改Node.js版本
106+
- 添加代码质量检查
107+
- 配置不同的部署目标
108+
- 添加通知机制

.github/workflows/build-test.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build Test
2+
3+
on:
4+
# 在推送到除main以外的分支时触发
5+
push:
6+
branches-ignore: [ main ]
7+
# 在所有拉取请求时触发
8+
pull_request:
9+
branches: [ '**' ]
10+
11+
jobs:
12+
build-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18'
22+
cache: 'npm'
23+
cache-dependency-path: './mofa-website/package-lock.json'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
working-directory: ./mofa-website
28+
29+
- name: Build with Astro
30+
run: npm run build
31+
working-directory: ./mofa-website
32+
33+
- name: Check build output
34+
run: |
35+
if [ -d "./docs" ]; then
36+
echo "✅ Build successful - docs directory created"
37+
ls -la ./docs
38+
echo "📊 Build statistics:"
39+
echo "Files: $(find ./docs -type f | wc -l)"
40+
echo "Size: $(du -sh ./docs | cut -f1)"
41+
else
42+
echo "❌ Build failed - docs directory not found"
43+
exit 1
44+
fi

.github/workflows/deploy.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build to Docs
2+
3+
on:
4+
# 在每次推送到main分支时触发
5+
push:
6+
branches: [ main ]
7+
# 在每次拉取请求到main分支时触发
8+
pull_request:
9+
branches: [ main ]
10+
# 允许手动触发
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '18'
26+
cache: 'npm'
27+
cache-dependency-path: './mofa-website/package-lock.json'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
working-directory: ./mofa-website
32+
33+
- name: Build with Astro
34+
run: npm run build
35+
working-directory: ./mofa-website
36+
37+
- name: Commit and push docs
38+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
39+
run: |
40+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
41+
git config --local user.name "github-actions[bot]"
42+
git add docs/
43+
if git diff --staged --quiet; then
44+
echo "No changes to commit"
45+
else
46+
git commit -m "🚀 Auto-build: Update docs from latest changes"
47+
git push
48+
fi

docs/assets/0.overview.3e20ac83.js

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/0.overview.3fd3ea85.js

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
async function getMod() {
2-
return import('./quick-start.9acb7182.js');
2+
return import('./0.overview.3fd3ea85.js');
33
}
44
const collectedLinks = "@@ASTRO-LINKS@@";
55
const collectedStyles = "@@ASTRO-STYLES@@";

docs/assets/agents.8fe1f333.js

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
async function getMod() {
2-
return import('./introducing-mofa.c6746abe.js');
2+
return import('./agents.c3a5804b.js');
33
}
44
const collectedLinks = "@@ASTRO-LINKS@@";
55
const collectedStyles = "@@ASTRO-STYLES@@";

0 commit comments

Comments
 (0)