Skip to content

Commit 0c14322

Browse files
committed
Implement automatic API docs generation
1 parent 82d283a commit 0c14322

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

Diff for: .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

Diff for: .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'

Diff for: .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'

0 commit comments

Comments
 (0)