Skip to content

Commit c1c605d

Browse files
authored
Implement multi version for apiref (#4190)
1 parent c204adf commit c1c605d

File tree

6 files changed

+52
-18
lines changed

6 files changed

+52
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Session.vim
5151
.*.timestamp
5252
/site
5353
go.work.sum
54+
/tmp
5455

5556
/cache
5657
.venv/

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ build-docs:
182182

183183
.PHONY: build-docs-netlify
184184
build-docs-netlify: api-ref-docs
185-
hack/mkdocs/generate.sh
186185
pip install -r hack/mkdocs/image/requirements.txt
187186
python -m mkdocs build
188187

RELEASE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ The following steps must be done by one of the [Gateway API maintainers][gateway
7474
Attach these files to the GitHub release.
7575
- Update the `README.md` and `site-src/guides/index.md` files to point links and examples to the new release.
7676
- Update the implementation table path (`nav.Implementations.Comparison`) in the nav of `mkdocs.yml` to point to the latest release file (for example Implementation Comparison points to `implementation-table-v1.2.0.md`). Add the now past version under `Past Version Comparisons`, and edit the text blurb in `mkdocs-generate-conformance.py` to also reflect the added past version.
77+
- Update `hack/mkdocs/generate.sh` and add the new `release-x.x` to the array of releases.
78+
- Update `nav.yml.tmpl` and add the new release to the `API specification` field. Execute `./hack/update-mkdocs-nav.sh` after that.
7779

7880
#### For an **RC** release:
7981
- Update `pkg/consts/consts.go` with the new semver tag (like `v1.2.0-rc1`) and any updates to the API review URL.

hack/mkdocs/generate.sh

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,41 @@ GOPATH=${GOPATH:-$(go env GOPATH)}
2424
# have to manually default it.
2525
GOBIN=${GOBIN:-$(go env GOBIN)}
2626
GOBIN=${GOBIN:-${GOPATH}/bin}
27+
REMOTE=${REMOTE:-origin}
2728

2829
readonly GOTOOL="go tool"
2930

3031
echo $GOBIN
3132

3233
go install github.com/elastic/crd-ref-docs
34+
declare -a arr=(
35+
"release-1.3"
36+
"release-1.4"
37+
"main"
38+
)
3339

34-
$GOTOOL crd-ref-docs \
35-
--source-path=${PWD}/apis \
36-
--config=crd-ref-docs.yaml \
37-
--templates-dir=${PWD}/hack/crd-ref-templates/ \
38-
--renderer=markdown \
39-
--output-path=${PWD}/site-src/reference/spec.md
40-
41-
$GOTOOL crd-ref-docs \
42-
--source-path=${PWD}/apisx \
43-
--config=crd-ref-docs.yaml \
44-
--templates-dir=${PWD}/hack/crd-ref-templates/ \
45-
--renderer=markdown \
46-
--output-path=${PWD}/site-src/reference/specx.md
40+
mkdir -p ${PWD}/tmp
41+
42+
for i in "${arr[@]}"; do
43+
tmpdir=$(mktemp -d --tmpdir=${PWD}/tmp)
44+
45+
git fetch ${REMOTE} ${i}
46+
git --work-tree=${tmpdir} checkout ${REMOTE}/${i} -- apis apisx
47+
48+
docpath=${i#"release-"}
49+
mkdir -p "${PWD}/site-src/reference/${docpath}"
50+
51+
$GOTOOL crd-ref-docs \
52+
--source-path=${tmpdir}/apis \
53+
--config=crd-ref-docs.yaml \
54+
--templates-dir=${PWD}/hack/crd-ref-templates/ \
55+
--renderer=markdown \
56+
--output-path=${PWD}/site-src/reference/${docpath}/spec.md
57+
58+
$GOTOOL crd-ref-docs \
59+
--source-path=${tmpdir}/apisx \
60+
--config=crd-ref-docs.yaml \
61+
--templates-dir=${PWD}/hack/crd-ref-templates/ \
62+
--renderer=markdown \
63+
--output-path=${PWD}/site-src/reference/${docpath}/specx.md
64+
done

nav.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,15 @@ nav:
5656
- BackendTrafficPolicy: api-types/backendtrafficpolicy.md
5757
- ReferenceGrant: api-types/referencegrant.md
5858
- API specification:
59-
- Standard: reference/spec.md
60-
- Experimental: reference/specx.md
59+
- Development:
60+
- Standard: reference/main/spec.md
61+
- Experimental: reference/main/specx.md
62+
- v1.4:
63+
- Standard: reference/1.4/spec.md
64+
- Experimental: reference/1.4/specx.md
65+
- v1.3:
66+
- Standard: reference/1.3/spec.md
67+
- Experimental: reference/1.3/specx.md
6168
- Policy Attachment: reference/policy-attachment.md
6269
- Enhancements:
6370
- Overview: geps/overview.md

nav.yml.tmpl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,15 @@ nav:
5656
- BackendTrafficPolicy: api-types/backendtrafficpolicy.md
5757
- ReferenceGrant: api-types/referencegrant.md
5858
- API specification:
59-
- Standard: reference/spec.md
60-
- Experimental: reference/specx.md
59+
- Development:
60+
- Standard: reference/main/spec.md
61+
- Experimental: reference/main/specx.md
62+
- v1.4:
63+
- Standard: reference/1.4/spec.md
64+
- Experimental: reference/1.4/specx.md
65+
- v1.3:
66+
- Standard: reference/1.3/spec.md
67+
- Experimental: reference/1.3/specx.md
6168
- Policy Attachment: reference/policy-attachment.md
6269
- Enhancements:
6370
- Overview: geps/overview.md

0 commit comments

Comments
 (0)