Skip to content

Commit 520a203

Browse files
committed
Implement automatic API docs generation
1 parent 82d283a commit 520a203

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

Diff for: .github/workflows/test.yml

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

0 commit comments

Comments
 (0)