forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (152 loc) · 3.91 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Verify & Publish Docs
on:
workflow_dispatch:
repository_dispatch:
types: [ publish-release ]
push:
branches:
- main
paths:
- docs/**
- package*.json
- markdownlint.json
- .remarkrc.yaml
- mkdocs.yml
- .github/workflows/docs.yml
pull_request:
branches:
- main
paths:
- docs/**
- package*.json
- markdownlint.json
- .remarkrc.yaml
- mkdocs.yml
- .github/workflows/docs.yml
env:
DOTNET_ROLL_FORWARD: "Major"
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
jobs:
prepare:
name: Prepare Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Cache cake frosting
id: cache-cake
uses: actions/cache@v4
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v4
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Get npm cache directory
shell: bash
id: cache-node-dir
run: |
cacheDir=$(npm config get cache)
echo "dir=$cacheDir" >> $GITHUB_OUTPUT
-
name: Cache Node Modules
id: cache-node
uses: actions/cache@v4
with:
path: ${{ steps.cache-node-dir.outputs.dir }}
key: node-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
restore-keys: node-${{ runner.os }}
-
name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
-
name: '[Build]'
if: steps.cache-cake.outputs.cache-hit != 'true'
run: dotnet build build/CI.sln --configuration=Release
-
name: '[Prepare]'
shell: pwsh
run: dotnet run/build.dll --target=BuildPrepare
validate:
name: Validates Html
needs: [ prepare ]
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
name: '[Build Documentation]'
shell: pwsh
run: dotnet run/docs.dll --target=BuildDocs
-
name: '[HTMLProofer]'
uses: chabad360/htmlproofer@master
with:
directory: ./artifacts/docs/preview
arguments: --ignore-urls /api/,/docs/,/5.12.0/ --allow-hash-href --allow-missing-href --assume-extension --disable-external --no-check_external_hash
-
name: '[Reviewdog Reporter]'
id: reporter
run: |
value=$([ ${{ github.event_name == 'pull_request' }} ] && echo "github-pr-review" || echo "github-check")
echo "value=$value" >> $GITHUB_OUTPUT
-
name: '[Remark Lint]'
uses: reviewdog/action-remark-lint@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
publish:
name: Publish docs
needs: [ validate ]
runs-on: windows-latest
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
name: '[Build Schemas]'
shell: pwsh
run: |
dotnet run/docs.dll --target=GenerateSchemas
-
name: '[Publish Documentation]'
if: ${{ github.event_name == 'repository_dispatch' }}
shell: pwsh
run: dotnet run/docs.dll --target=PublishDocs
-
name: '[Publish Documentation]'
if: ${{ github.event_name == 'workflow_dispatch' }}
shell: pwsh
run: dotnet run/docs.dll --target=PublishDocs --force