Skip to content

Commit 902b530

Browse files
committed
chore: update docs script
1 parent 46eb8c1 commit 902b530

3 files changed

Lines changed: 121 additions & 6 deletions

File tree

docs/antora.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,29 @@
1616
#
1717

1818
# Another part of this distributed component is in camel-k-runtime docs
19-
2019
name: camel-k
2120
title: Camel K
2221
version: 1.10.x
2322
nav:
24-
- modules/ROOT/nav.adoc
25-
- modules/languages/nav-languages.adoc
26-
- modules/ROOT/nav-end.adoc
27-
23+
- modules/ROOT/nav.adoc
24+
- modules/languages/nav-languages.adoc
25+
- modules/ROOT/nav-end.adoc
2826
# On release, update this to the appropriate released camel version.
2927
asciidoc:
3028
attributes:
3129
requires: "'util=camel-website-util,ck=xref:js/ck.js'"
30+
<<<<<<< HEAD
3231
lts: LTS
3332
prerelease: false
3433
camel-kamelets-version: 0.9.3 # Makefile KAMELET_CATALOG_REPO_BRANCH
3534
camel-kamelets-docs-version: 0.9.x # Makefile KAMELET_CATALOG_REPO_BRANCH
3635
camel-k-runtime-version: 1.15.2 # Makefile RUNTIME_VERSION
36+
=======
37+
prerelease: true
38+
camel-kamelets-version: 0.10.0 # Makefile KAMELET_CATALOG_REPO_BRANCH
39+
camel-kamelets-docs-version: 0.10.x # Makefile KAMELET_CATALOG_REPO_BRANCH
40+
camel-k-runtime-version: 1.16.0 # Makefile RUNTIME_VERSION
41+
>>>>>>> 80f3e3865 (chore: update docs script)
3742
camel-api-versions: camel.apache.org/v1 camel.apache.org/v1alpha1 # Makefile BUNDLE_CAMEL_APIS
3843
# from camel-k-runtime parent pom:
3944
camel-version: 3.18.2
@@ -43,4 +48,11 @@ asciidoc:
4348
quarkus-version: 2.13.0.Final
4449
graalvm-version: 22.1.0
4550
graalvm-docs-version: 22.1
46-
51+
buildah-version: 1.23.3
52+
kaniko-version: 0.17.1
53+
kustomize-version: 4.1.2
54+
kubernetes-api-version: 0.23.8
55+
operator-fwk-api-version: 0.13.0
56+
knative-api-version: 0.33.0
57+
service-binding-op-version: 1.3.1
58+
prometheus-op-version: 0.50.0

script/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ endef
134134
export LICENSE_HEADER
135135
default: build
136136

137+
update-docs: build-resources
138+
./script/update_docs.sh
139+
137140
bump-replace:
138141
@# Bump version and replace with the variables provided by the user
139142
@sed -i 's/^VERSION ?= .*$//VERSION ?= $(VERSION)/' ./script/Makefile

script/update_docs.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
location=$(dirname $0)
19+
20+
echo "Scraping information from Makefile"
21+
RUNTIME_VERSION=$(grep '^RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //')
22+
23+
CATALOG="$location/../resources/camel-catalog-$RUNTIME_VERSION.yaml"
24+
# This script requires the catalog to be available (via make build-resources for instance)
25+
if [ ! -f $CATALOG ]; then
26+
echo "❗ catalog not available. Make sure to download it before calling this script."
27+
exit 1
28+
fi
29+
30+
KAMELETS_VERSION=$(grep '^KAMELET_CATALOG_REPO_BRANCH := ' Makefile | sed 's/^.* \?= //' | sed 's/^.//')
31+
re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
32+
if ! [[ $KAMELETS_VERSION =~ $re ]]; then
33+
echo "❗ argument must match semantic version: $KAMELETS_VERSION"
34+
exit 1
35+
fi
36+
KAMELETS_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
37+
BUILDAH_VERSION=$(grep '^BUILDAH_VERSION := ' Makefile | sed 's/^.* \?= //')
38+
KANIKO_VERSION=$(grep '^KANIKO_VERSION := ' Makefile | sed 's/^.* \?= //')
39+
KUSTOMIZE_VERSION=$(grep '^KUSTOMIZE_VERSION := ' Makefile | sed 's/^.* \?= //' | sed 's/^.//')
40+
41+
echo "Camel K Runtime version: $RUNTIME_VERSION"
42+
echo "Kamelets version: $KAMELETS_VERSION"
43+
echo "Buildah version: $BUILDAH_VERSION"
44+
echo "Kaniko version: $KANIKO_VERSION"
45+
echo "Kustomize version: $KUSTOMIZE_VERSION"
46+
47+
yq -i ".asciidoc.attributes.buildah-version = \"$BUILDAH_VERSION\"" $location/../docs/antora.yml
48+
yq -i ".asciidoc.attributes.kaniko-version = \"$KANIKO_VERSION\"" $location/../docs/antora.yml
49+
yq -i ".asciidoc.attributes.kustomize-version = \"$KUSTOMIZE_VERSION\"" $location/../docs/antora.yml
50+
51+
echo "Scraping information from catalog available at: $CATALOG"
52+
RUNTIME_VERSION=$(yq '.spec.runtime.version' $CATALOG)
53+
CAMEL_VERSION=$(yq '.spec.runtime.metadata."camel.version"' $CATALOG)
54+
re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
55+
if ! [[ $CAMEL_VERSION =~ $re ]]; then
56+
echo "❗ argument must match semantic version: $CAMEL_VERSION"
57+
exit 1
58+
fi
59+
CAMEL_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
60+
CAMEL_QUARKUS_VERSION=$(yq '.spec.runtime.metadata."camel-quarkus.version"' $CATALOG)
61+
re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
62+
if ! [[ $CAMEL_QUARKUS_VERSION =~ $re ]]; then
63+
echo "❗ argument must match semantic version: $CAMEL_QUARKUS_VERSION"
64+
exit 1
65+
fi
66+
CAMEL_QUARKUS_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
67+
QUARKUS_VERSION=$(yq '.spec.runtime.metadata."quarkus.version"' $CATALOG)
68+
69+
echo "Camel K Runtime version: $RUNTIME_VERSION"
70+
echo "Camel version: $CAMEL_VERSION"
71+
echo "Camel Quarkus version: $CAMEL_QUARKUS_VERSION"
72+
echo "Quarkus version: $QUARKUS_VERSION"
73+
74+
yq -i ".asciidoc.attributes.camel-k-runtime-version = \"$RUNTIME_VERSION\"" $location/../docs/antora.yml
75+
yq -i ".asciidoc.attributes.camel-version = \"$CAMEL_VERSION\"" $location/../docs/antora.yml
76+
yq -i ".asciidoc.attributes.camel-docs-version = \"$CAMEL_DOCS_VERSION\"" $location/../docs/antora.yml
77+
yq -i ".asciidoc.attributes.camel-quarkus-version = \"$CAMEL_QUARKUS_VERSION\"" $location/../docs/antora.yml
78+
yq -i ".asciidoc.attributes.camel-quarkus-docs-version = \"$CAMEL_QUARKUS_DOCS_VERSION\"" $location/../docs/antora.yml
79+
yq -i ".asciidoc.attributes.quarkus-version = \"$QUARKUS_VERSION\"" $location/../docs/antora.yml
80+
yq -i ".asciidoc.attributes.camel-kamelets-version = \"$KAMELETS_VERSION\"" $location/../docs/antora.yml
81+
yq -i ".asciidoc.attributes.camel-kamelets-docs-version = \"$KAMELETS_DOCS_VERSION\"" $location/../docs/antora.yml
82+
83+
echo "Scraping information from go.mod"
84+
KNATIVE_API_VERSION=$(grep '^.*knative.dev/eventing ' $location/../go.mod | sed 's/^.* //' | sed 's/^.//')
85+
KUBE_API_VERSION=$(grep '^.*k8s.io/api ' $location/../go.mod | sed 's/^.* //' | sed 's/^.//')
86+
OPERATOR_FWK_API_VERSION=$(grep '^.*github.com/operator-framework/api ' $location/../go.mod | sed 's/^.* //' | sed 's/^.//')
87+
SERVICE_BINDING_OP_VERSION=$(grep '^.*github.com/redhat-developer/service-binding-operator ' $location/../go.mod | sed 's/^.* //' | sed 's/^.//')
88+
PROMETHEUS_OP_VERSION=$(grep '^.*github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring ' $location/../go.mod | sed 's/^.* //' | sed 's/^.//')
89+
90+
echo "Kubernetes API version: $KUBE_API_VERSION"
91+
echo "Operator Framework API version: $OPERATOR_FWK_API_VERSION"
92+
echo "KNative API version: $KNATIVE_API_VERSION"
93+
echo "Service Binding Operator version: $SERVICE_BINDING_OP_VERSION"
94+
echo "Prometheus Operator version: $PROMETHEUS_OP_VERSION"
95+
96+
yq -i ".asciidoc.attributes.kubernetes-api-version = \"$KUBE_API_VERSION\"" $location/../docs/antora.yml
97+
yq -i ".asciidoc.attributes.operator-fwk-api-version = \"$OPERATOR_FWK_API_VERSION\"" $location/../docs/antora.yml
98+
yq -i ".asciidoc.attributes.knative-api-version = \"$KNATIVE_API_VERSION\"" $location/../docs/antora.yml
99+
yq -i ".asciidoc.attributes.service-binding-op-version = \"$SERVICE_BINDING_OP_VERSION\"" $location/../docs/antora.yml
100+
yq -i ".asciidoc.attributes.prometheus-op-version = \"$PROMETHEUS_OP_VERSION\"" $location/../docs/antora.yml

0 commit comments

Comments
 (0)