File tree Expand file tree Collapse file tree 4 files changed +436
-1
lines changed Expand file tree Collapse file tree 4 files changed +436
-1
lines changed Original file line number Diff line number Diff line change 6
6
pull_request :
7
7
paths :
8
8
- ' cmd/thv-operator/**'
9
- - ' deploy/charts/operator/**'
10
9
- ' deploy/charts/operator-crds/**'
11
10
- ' go.mod'
12
11
- ' go.sum'
@@ -112,4 +111,37 @@ jobs:
112
111
if : steps.git-check.outputs.crd-changes == 'true' || steps.git-check.outputs.operator-changes == 'true'
113
112
run : |
114
113
echo "CRDs are not up to date. Please run 'task operator-manifests' and commit the changes."
114
+ exit 1
115
+
116
+ generate-crd-docs :
117
+ name : Generate CRD Docs
118
+ runs-on : ubuntu-latest
119
+ steps :
120
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
121
+
122
+ - name : Set up Go
123
+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
124
+ with :
125
+ go-version-file : ' go.mod'
126
+ cache : true
127
+
128
+ - name : Install Task
129
+ uses : arduino/setup-task@v2
130
+ with :
131
+ version : 3.x
132
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
133
+
134
+ - name : Generate CRD Docs
135
+ run : task crdref-gen
136
+ working-directory : cmd/thv-operator
137
+
138
+ - name : Check for changes
139
+ id : git-docs-check
140
+ run : |
141
+ git diff --exit-code -- docs/operator/crd-api.md || echo "crd-changes=true" >> $GITHUB_OUTPUT
142
+
143
+ - name : Fail if CRDs are not up to date
144
+ if : steps.git-docs-check.outputs.crd-changes == 'true'
145
+ run : |
146
+ echo "Docs for CRDs are not up to date. Please run 'task crdref-gen' and commit the changes."
115
147
exit 1
Original file line number Diff line number Diff line change 1
1
version : ' 3'
2
2
3
+ vars :
4
+ CRD_DIR : config/crd/bases
5
+ DOCS_OUT : ../../docs/operator/crd-api.md
6
+ CRDREF_CONFIG : ../../docs/operator/crd-ref-config.yaml
7
+
3
8
tasks :
4
9
kind-setup :
5
10
desc : Setup a local Kind cluster
@@ -134,3 +139,19 @@ tasks:
134
139
cmds :
135
140
- go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
136
141
- KUBEBUILDER_ASSETS="$(shell setup-envtest use 1.28.0 -p path)" go test ./cmd/thv-operator/... -coverprofile cover.out
142
+
143
+ crdref-install :
144
+ desc : Install elastic/crd-ref-docs
145
+ cmds :
146
+ - go install github.com/elastic/crd-ref-docs@latest
147
+
148
+ crdref-gen :
149
+ desc : Generate CRD API docs via crd-ref-docs
150
+ deps : [crdref-install]
151
+ cmds :
152
+ - crd-ref-docs --source-path=. --config={{ .CRDREF_CONFIG }} --renderer markdown --output-path {{ .DOCS_OUT }}
153
+ sources :
154
+ - ' config/crd/bases/**/*.yaml'
155
+ - ' api/**/*.go'
156
+ generates :
157
+ - ' {{ .DOCS_OUT }}'
You can’t perform that action at this time.
0 commit comments