diff --git a/.github/workflows/docs-gen-and-push.yaml b/.github/workflows/docs-gen-and-push.yaml index 4cfc0aa..11bf96a 100644 --- a/.github/workflows/docs-gen-and-push.yaml +++ b/.github/workflows/docs-gen-and-push.yaml @@ -1,4 +1,4 @@ -name: Generate and push docs +name: Documentation on: # So we can trigger manually if needed @@ -24,7 +24,7 @@ concurrency: jobs: generate-and-push: - name: Generate and push docs + name: Generate and push runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 @@ -42,4 +42,10 @@ jobs: python-version: '3.10' cache: 'pip' - - run: make deploy-docs + # mike does not support giving CLI flags for mkdocs, but we also do not + # want to permanently enable strict mode, so here we enable it just for this + # task + - run: | + echo "strict: true" >> docs/mkdocs.yml + + - run: make generate-api-docs deploy-docs diff --git a/Makefile b/Makefile index c8528ad..7ad46d9 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,11 @@ verify: VENVDIR=$(abspath docs/venv) REQUIREMENTS_TXT=docs/requirements.txt +.PHONY: generate-api-docs +generate-api-docs: ## Generate api docs + git clean -fdX docs/content/reference + docs/generators/crd-ref/run-crd-ref-gen.sh + .PHONY: local-docs local-docs: venv ## Run mkdocs serve . $(VENV)/activate; \ diff --git a/docs/content/.pages b/docs/content/.pages index 830682c..aba5f84 100644 --- a/docs/content/.pages +++ b/docs/content/.pages @@ -4,4 +4,5 @@ nav: - Publishing Resources: publish-resources - Consuming Services: consuming-services.md - FAQ: faq.md + - Reference: reference - Contributing: contributing diff --git a/docs/content/reference/.gitignore b/docs/content/reference/.gitignore new file mode 100644 index 0000000..fb4e233 --- /dev/null +++ b/docs/content/reference/.gitignore @@ -0,0 +1 @@ +crd/ diff --git a/docs/content/reference/.pages b/docs/content/reference/.pages new file mode 100644 index 0000000..561adb2 --- /dev/null +++ b/docs/content/reference/.pages @@ -0,0 +1,3 @@ +nav: + - index.md + - CRD: crd diff --git a/docs/content/reference/index.md b/docs/content/reference/index.md new file mode 100644 index 0000000..b802c5f --- /dev/null +++ b/docs/content/reference/index.md @@ -0,0 +1,3 @@ +# Reference + +This chapter provides automatically generated references for the APIs provided by the kcp Sync Agent. diff --git a/docs/generators/crd-ref/config.yaml b/docs/generators/crd-ref/config.yaml new file mode 100644 index 0000000..01462b4 --- /dev/null +++ b/docs/generators/crd-ref/config.yaml @@ -0,0 +1,29 @@ +# Copyright 2021 The KCP Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +template_path: ./crd.template.md + +source_repositories: + - url: https://github.com/kcp-dev/api-syncagent + organization: kcp-dev + short_name: api-syncagent + commit_reference: main + crd_paths: + - deploy/crd + cr_paths: + - docs/cr + metadata: + publishedresources.syncagent.kcp.io: + owner: + - https://github.com/kcp-dev/api-syncagent diff --git a/docs/generators/crd-ref/crd.template.md b/docs/generators/crd-ref/crd.template.md new file mode 100644 index 0000000..7ac1aa5 --- /dev/null +++ b/docs/generators/crd-ref/crd.template.md @@ -0,0 +1,118 @@ +--- +title: {{ .Title }} +description: | +{{- if .Description }} +{{ .Description | indent 2 }} +{{- else }} + Custom resource definition (CRD) schema reference page for the {{ .Title }} + resource ({{ .NamePlural }}.{{ .Group }}), as part of the Giant Swarm + Management API documentation. +{{- end }} +weight: {{ .Weight }} +--- + +{{- with .Metadata.Deprecation }} +{{ "{{" }}% pageinfo color="warning" %{{ "}}"}} +{{- with .Info }} +{{ . }} +{{- end }} +{{- with .ReplacedBy }} +This CRD is being replaced by {{ .ShortName }}. +{{- end }} +{{"{{% /pageinfo %}}"}} +{{- end }} + +## {{ .Title }} CRD schema reference (group {{ .Group }}) +