This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 45a87cdebd3e6d04cd0635c12b253402b82706a8
Author: Pasquale Congiusti <pasquale.congiu...@gmail.com>
AuthorDate: Fri Dec 16 12:49:48 2022 +0100

    feat(doc): automatic doc configuration
    
    Closes #3867
---
 .github/actions/automatic-updates/action.yml       |  9 +--
 docs/antora.yml                                    | 32 +++++------
 pkg/util/defaults/defaults.go                      |  2 +-
 ...6.0.yaml => camel-catalog-1.17.0-SNAPSHOT.yaml} |  6 +-
 script/Makefile                                    |  5 +-
 script/update_docs.sh                              | 65 ++++++++++++++++++++++
 6 files changed, 91 insertions(+), 28 deletions(-)

diff --git a/.github/actions/automatic-updates/action.yml 
b/.github/actions/automatic-updates/action.yml
index 9cc645919..a1cd5e306 100644
--- a/.github/actions/automatic-updates/action.yml
+++ b/.github/actions/automatic-updates/action.yml
@@ -29,7 +29,7 @@ runs:
       with:
         token: ${{ secrets.GITHUB_TOKEN }}
         release_branch: ${{ inputs.branch-ref }}
-    - name: Commit files
+    - name: Commit changelog
       env:
         CI_USER: "github-actions[bot]"
         CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
@@ -37,15 +37,16 @@ runs:
         git config --local user.email "$CI_EMAIL"
         git config --local user.name "$CI_USER"
         git add CHANGELOG.md && git commit -m 'chore: changelog automatic 
update' && echo "changelog=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG"
-    - name: Make generate and commit
+    - name: Run refresh actions and commit
       env:
         CI_USER: "github-actions[bot]"
         CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
       run: |
         make generate
-        git add -A && git commit -m 'chore: make generate automatic update' && 
echo "make_generate=1" >> $GITHUB_ENV || echo "No changes to Make generate"
+        make update-docs
+        git add -A && git commit -m 'chore: nightly resource refresh' && echo 
"refresh=1" >> $GITHUB_ENV || echo "No changes to make update-docs"
     - name: Push changes
-      if: env.changelog == 1 || env.make_generate == 1
+      if: env.changelog == 1 || env.refresh == 1
       env:
         CI_USER: "github-actions[bot]"
         CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
diff --git a/docs/antora.yml b/docs/antora.yml
index 428378a7b..468473f4e 100644
--- a/docs/antora.yml
+++ b/docs/antora.yml
@@ -16,32 +16,26 @@
 #
 
 # Another part of this distributed component is in camel-k-runtime docs
-
 name: camel-k
 title: Camel K
 version: next
 prerelease: true
 display-version: Next (Pre-release)
 nav:
-- modules/ROOT/nav.adoc
-- modules/languages/nav-languages.adoc
-- modules/ROOT/nav-end.adoc
-
-# On release, update this to the appropriate released camel version.
+  - modules/ROOT/nav.adoc
+  - modules/languages/nav-languages.adoc
+  - modules/ROOT/nav-end.adoc
+# It should be automatically generated by an action running nightly
 asciidoc:
   attributes:
     requires: "'util=camel-website-util,ck=xref:js/ck.js'"
     prerelease: true
-    camel-kamelets-version: 0.10.0 # Makefile KAMELET_CATALOG_REPO_BRANCH
-    camel-kamelets-docs-version: 0.9.x # Makefile KAMELET_CATALOG_REPO_BRANCH
-    camel-k-runtime-version: 1.15.0 # Makefile RUNTIME_VERSION
-    camel-api-versions: camel.apache.org/v1 camel.apache.org/v1alpha1 # 
Makefile BUNDLE_CAMEL_APIS
-    # from camel-k-runtime parent pom:
-    camel-version: 3.18.0
-    camel-docs-version: 3.18.x
-    camel-quarkus-version: 2.11.0
-    camel-quarkus-docs-version: 2.11.x
-    quarkus-version: 2.11.3.Final
-    graalvm-version: 22.1.0
-    graalvm-docs-version: 22.1
-
+    camel-kamelets-version: 0.10.0
+    camel-kamelets-docs-version: 0.10.x
+    camel-k-runtime-version: 1.17.0-SNAPSHOT
+    camel-api-versions: camel.apache.org/v1 camel.apache.org/v1alpha1 # from 
Makefile BUNDLE_CAMEL_APIS
+    camel-version: 3.19.0
+    camel-docs-version: 3.19.x
+    camel-quarkus-version: 2.14.0
+    camel-quarkus-docs-version: 2.14.x
+    quarkus-version: 2.14.0.Final
diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go
index 29c99a846..3297388a4 100644
--- a/pkg/util/defaults/defaults.go
+++ b/pkg/util/defaults/defaults.go
@@ -26,7 +26,7 @@ const (
        Version = "1.12.0-SNAPSHOT"
 
        // DefaultRuntimeVersion --
-       DefaultRuntimeVersion = "1.16.0"
+       DefaultRuntimeVersion = "1.17.0-SNAPSHOT"
 
        // BuildahVersion --
        BuildahVersion = "1.23.3"
diff --git a/resources/camel-catalog-1.16.0.yaml 
b/resources/camel-catalog-1.17.0-SNAPSHOT.yaml
similarity index 99%
rename from resources/camel-catalog-1.16.0.yaml
rename to resources/camel-catalog-1.17.0-SNAPSHOT.yaml
index 7d40c3152..76bb47453 100644
--- a/resources/camel-catalog-1.16.0.yaml
+++ b/resources/camel-catalog-1.17.0-SNAPSHOT.yaml
@@ -18,15 +18,15 @@
 apiVersion: camel.apache.org/v1
 kind: CamelCatalog
 metadata:
-  name: camel-catalog-1.16.0
+  name: camel-catalog-1.17.0-snapshot
   labels:
     app: camel-k
     camel.apache.org/catalog.loader.version: 3.19.0
     camel.apache.org/catalog.version: 3.19.0
-    camel.apache.org/runtime.version: 1.16.0
+    camel.apache.org/runtime.version: 1.17.0-SNAPSHOT
 spec:
   runtime:
-    version: 1.16.0
+    version: 1.17.0-SNAPSHOT
     provider: quarkus
     applicationClass: io.quarkus.bootstrap.runner.QuarkusEntryPoint
     metadata:
diff --git a/script/Makefile b/script/Makefile
index 33418f8dc..17f52f821 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -23,7 +23,7 @@ VERSIONFILE := pkg/util/defaults/defaults.go
 VERSION ?= 1.12.0-SNAPSHOT
 LAST_RELEASED_IMAGE_NAME := camel-k-operator
 LAST_RELEASED_VERSION ?= 1.11.0
-RUNTIME_VERSION := 1.16.0
+RUNTIME_VERSION := 1.17.0-SNAPSHOT
 BUILDAH_VERSION := 1.23.3
 KANIKO_VERSION := 0.17.1
 INSTALL_DEFAULT_KAMELETS ?= true
@@ -140,6 +140,9 @@ endef
 export LICENSE_HEADER
 default: build
 
+update-docs: build-resources
+       ./script/update_docs.sh
+
 bump-replace:
        @# Bump version and replace with the variables provided by the user
        @sed -i 's/^VERSION ?= .*$//VERSION ?= $(VERSION)/' ./script/Makefile
diff --git a/script/update_docs.sh b/script/update_docs.sh
new file mode 100755
index 000000000..2444b6004
--- /dev/null
+++ b/script/update_docs.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+location=$(dirname $0)
+RUNTIME_VERSION=$(grep '^RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //')
+KAMELETS_VERSION=$(grep '^KAMELET_CATALOG_REPO_BRANCH := ' Makefile | sed 
's/^.* \?= //' | sed 's/^.//')
+re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
+if ! [[ $KAMELETS_VERSION =~ $re ]]; then
+    echo "❗ argument must match semantic version: $KAMELETS_VERSION"
+    exit 1
+fi
+KAMELETS_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
+
+CATALOG="$location/../resources/camel-catalog-$RUNTIME_VERSION.yaml"
+# This script requires the catalog to be available (via make build-resources 
for instance)
+if [ ! -f $CATALOG ]; then
+    echo "❗ catalog not available. Make sure to download it before calling 
this script."
+    exit 1
+fi
+echo "Scraping information from catalog available at: $CATALOG"
+RUNTIME_VERSION=$(yq '.spec.runtime.version' $CATALOG)
+CAMEL_VERSION=$(yq '.spec.runtime.metadata."camel.version"' $CATALOG)
+re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
+if ! [[ $CAMEL_VERSION =~ $re ]]; then
+    echo "❗ argument must match semantic version: $CAMEL_VERSION"
+    exit 1
+fi
+CAMEL_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
+CAMEL_QUARKUS_VERSION=$(yq '.spec.runtime.metadata."camel-quarkus.version"' 
$CATALOG)
+re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
+if ! [[ $CAMEL_QUARKUS_VERSION =~ $re ]]; then
+    echo "❗ argument must match semantic version: $CAMEL_QUARKUS_VERSION"
+    exit 1
+fi
+CAMEL_QUARKUS_DOCS_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
+QUARKUS_VERSION=$(yq '.spec.runtime.metadata."quarkus.version"' $CATALOG)
+
+echo "Camel K Runtime version: $RUNTIME_VERSION"
+echo "Camel version: $CAMEL_VERSION"
+echo "Camel Quarkus version: $CAMEL_QUARKUS_VERSION"
+echo "Quarkus version: $QUARKUS_VERSION"
+echo "Kamelets version: $KAMELETS_VERSION"
+
+yq -i ".asciidoc.attributes.camel-k-runtime-version = \"$RUNTIME_VERSION\"" 
$location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-version = \"$CAMEL_VERSION\"" 
$location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-docs-version = \"$CAMEL_DOCS_VERSION\"" 
$location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-quarkus-version = 
\"$CAMEL_QUARKUS_VERSION\"" $location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-quarkus-docs-version = 
\"$CAMEL_QUARKUS_DOCS_VERSION\"" $location/../docs/antora.yml
+yq -i ".asciidoc.attributes.quarkus-version = \"$QUARKUS_VERSION\"" 
$location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-kamelets-version = \"$KAMELETS_VERSION\"" 
$location/../docs/antora.yml
+yq -i ".asciidoc.attributes.camel-kamelets-docs-version = 
\"$KAMELETS_DOCS_VERSION\"" $location/../docs/antora.yml
\ No newline at end of file

Reply via email to