Skip to content

Commit aa042ba

Browse files
github-actions[bot]flobernd
andauthoredNov 20, 2024··
API Reference Documentation (#8228) (#8417)
* Add `docfx` config * Implement automatic API docs generation Co-authored-by: Florian Bernd <[email protected]>
1 parent 2b5796f commit aa042ba

File tree

8 files changed

+128
-2
lines changed

8 files changed

+128
-2
lines changed
 

‎.github/workflows/docfx.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'CD'
2+
3+
# TODO: Remove 'stack'
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
release_tag:
9+
description: 'The release tag (release version)'
10+
type: 'string'
11+
required: true
12+
13+
concurrency:
14+
group: 'docfx-stack'
15+
cancel-in-progress: false
16+
17+
env:
18+
# Configuration
19+
GLOBAL_JSON_FILE: 'global.json'
20+
CACHE_PATTERNS: '["**/*.[cf]sproj*", "**/*.Build.props"]'
21+
# .NET SDK related environment variables
22+
DOTNET_NOLOGO: 1
23+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
24+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
25+
DOTNET_GENERATE_ASPNET_CERTIFICATE: 0
26+
27+
jobs:
28+
docfx:
29+
name: 'Generate API Documentation'
30+
runs-on: 'ubuntu-latest'
31+
steps:
32+
- name: 'Parse Version'
33+
id: 'version'
34+
uses: 'zyactions/semver@v1'
35+
with:
36+
version: ${{ inputs.release_tag }}
37+
38+
- name: 'Checkout'
39+
uses: 'actions/checkout@v4'
40+
41+
- name: '.NET Setup'
42+
uses: 'actions/setup-dotnet@v4'
43+
with:
44+
global-json-file: '${{ github.workspace }}/${{ env.GLOBAL_JSON_FILE }}'
45+
46+
- name: 'DocFX Setup'
47+
run: |-
48+
dotnet tool update -g docfx
49+
50+
- name: '.NET Cache Packages'
51+
uses: 'actions/cache@v4'
52+
with:
53+
path: '~/.nuget/packages'
54+
key: '${{ runner.os }}-nuget-stack-${{ hashFiles(fromJson(env.CACHE_PATTERNS)) }}'
55+
restore-keys: '${{ runner.os }}-nuget-stack-'
56+
57+
- name: 'DocFx Build'
58+
working-directory: 'docfx'
59+
run: |-
60+
docfx docfx.json
61+
mv ./_site ./../..
62+
63+
- name: 'Checkout'
64+
uses: 'actions/checkout@v4'
65+
with:
66+
ref: 'refdoc'
67+
68+
- name: 'Commit'
69+
run: |-
70+
rm -r "./${{ steps.version.outputs.version }}" || true
71+
mv ../_site "./${{ steps.version.outputs.version }}"
72+
git config --global user.name '${{ github.actor }}'
73+
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
74+
git add .
75+
git commit -am "Add ${{ steps.version.outputs.version }}"
76+
git push

‎.github/workflows/docfx_manual.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'DocFx'
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
docfx:
8+
name: 'Generate Documentation'
9+
uses: ./.github/workflows/docfx.yml
10+
with:
11+
release_tag: ${{ github.ref_name }}
12+
secrets: 'inherit'

‎.github/workflows/release_stack.yml

+8
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ jobs:
1616
release_tag: ${{ github.event.release.tag_name }}
1717
release_body: ${{ github.event.release.body }}
1818
secrets: 'inherit'
19+
20+
docfx:
21+
name: 'Generate Documentation'
22+
if: ${{ !startsWith(github.event.release.tag_name, 'serverless-') }}
23+
uses: ./.github/workflows/docfx.yml
24+
with:
25+
release_tag: ${{ github.event.release.tag_name }}
26+
secrets: 'inherit'

‎docfx/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_site
2+
api

‎docfx.json ‎docfx/docfx.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{
44
"src": [
55
{
6-
"src": "./src/Elastic.Clients.Elasticsearch",
6+
"src": "../src",
77
"files": [
8-
"**/*.csproj"
8+
"**/Elastic.Clients.Elasticsearch.csproj"
99
]
1010
}
1111
],
@@ -38,6 +38,7 @@
3838
"globalMetadata": {
3939
"_appName": "Elasticsearch.NET",
4040
"_appTitle": "Elasticsearch.NET",
41+
"_appLogoPath": "images/logo.svg",
4142
"_enableSearch": true,
4243
"_disableContribution": true,
4344
"pdf": false

‎docfx/images/logo.svg

+16
Loading

‎docfx/index.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
_layout: landing
3+
---
4+
5+
# Elasticsearch .NET API
6+
7+
This is the home of the Elasticsearch .NET Client API Reference Documentation.
8+
9+
Please click on `API` in the top menu to get to the API overview.

‎docfx/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: API
2+
href: api/

0 commit comments

Comments
 (0)
Please sign in to comment.