Skip to content

Commit e7c6d5b

Browse files
committed
Enable DocFX docs deployment with default project setup
- Add default DocFX config, home page, and TOC under docs/ - Add local tool manifest with docfx tool for workflow restore - Show fixed expected docs URL in workflow summary - Align build tool-manifest path and docs guidance in README/guide - Ignore generated docs/_site output Made-with: Cursor
1 parent 37b332c commit e7c6d5b

9 files changed

Lines changed: 73 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183
- uses: actions/cache@v5
184184
with:
185185
path: ~/.nuget/packages
186-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'global.json', '.config/dotnet-tools.json') }}
186+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'global.json', 'dotnet-tools.json') }}
187187
restore-keys: ${{ runner.os }}-nuget-
188188

189189
- name: Install .NET workloads

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ bld/
3333
[Oo]ut/
3434
[Ll]og/
3535
[Ll]ogs/
36+
docs/_site/
3637

3738
# Build results on 'Bin' directories
3839
**/[Bb]in/*

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ env:
148148

149149
To enable automatic documentation deployment to GitHub Pages:
150150

151-
1. Add a `docs/docfx.json` configuration file
151+
1. `docs/docfx.json` is included by default in this template
152152
2. Enable GitHub Pages in **Settings > Pages > Source: GitHub Actions**
153-
3. The `deploy-docs` job will automatically build and deploy after each release
153+
3. The `deploy-docs` job automatically builds and deploys after each release
154154
4. Expected docs URL: `https://<owner>.github.io/<repo>/` (for this repo: `https://agibuild.github.io/dotnet.CI.template/`)
155155

156156
The `Resolve Version` job summary always shows this expected docs URL, even when docs deployment is skipped.

build/BuildTask.Parameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ partial class BuildTask
3535

3636
AbsolutePath ReleaseManifestFile => PackagesDirectory / "release-manifest.json";
3737
AbsolutePath BuildOutputsMarkerFile => ArtifactsDirectory / ".build-outputs" / "build-outputs.json";
38-
AbsolutePath ToolManifestFile => RootDirectory / ".config" / "dotnet-tools.json";
38+
AbsolutePath ToolManifestFile => RootDirectory / "dotnet-tools.json";
3939
AbsolutePath DirectoryBuildPropsFile => RootDirectory / "Directory.Build.props";
4040
}

docs/docfx.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"metadata": [],
3+
"build": {
4+
"content": [
5+
{
6+
"files": [
7+
"index.md",
8+
"quick-start-release.md",
9+
"github-workflows-guide.md",
10+
"toc.yml"
11+
]
12+
}
13+
],
14+
"resource": [
15+
{
16+
"files": [
17+
"images/**"
18+
]
19+
}
20+
],
21+
"output": "_site",
22+
"template": [
23+
"default"
24+
],
25+
"globalMetadata": {
26+
"_appTitle": "dotnet.CI.template Docs",
27+
"_appFooter": "dotnet.CI.template",
28+
"_enableSearch": true
29+
},
30+
"sitemap": {
31+
"baseUrl": "https://agibuild.github.io/dotnet.CI.template/"
32+
}
33+
}
34+
}

docs/github-workflows-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ push / PR to main + weekly
8787
- 可选:配置 wait timer、deployment branches(限制为 `main`
8888

8989
### `github-pages` environment(可选)
90-
如果使用 DocFX 文档部署
90+
仓库已内置 `docs/docfx.json`,如需启用文档发布
9191
- Settings → Pages → Source 选择 GitHub Actions
9292
- environment `github-pages` 会自动创建
9393
- 预期文档地址:`https://<owner>.github.io/<repo>/`(本仓库为 `https://agibuild.github.io/dotnet.CI.template/`

docs/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# dotnet.CI.template 文档首页
2+
3+
这是一个开箱即用的 .NET CI/CD 模板,目标是把构建、测试、发布和文档部署标准化。
4+
5+
## 你可以从这里开始
6+
7+
- [Quick Start: Release in 2 Minutes](quick-start-release.md)
8+
- [GitHub Workflows 使用指南](github-workflows-guide.md)
9+
10+
## 文档发布说明
11+
12+
- 预期文档地址:`https://agibuild.github.io/dotnet.CI.template/`
13+
- 工作流会在 `deploy-docs` job 中执行 `dotnet docfx docs/docfx.json`
14+
- 若缺少 `docs/docfx.json` 或未启用 Pages,文档部署会被跳过

docs/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- name: 首页
2+
href: index.md
3+
- name: 快速发版
4+
href: quick-start-release.md
5+
- name: Workflows 指南
6+
href: github-workflows-guide.md

dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"docfx": {
6+
"version": "2.78.5",
7+
"commands": [
8+
"docfx"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)