Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add support list in release notes markdown #1401

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/call-gen-release-notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${latest_tag} |yq '.body' > docs/overrides/releases/${latest_tag}.md

- name: Add support list in release notes markdown
run: |
latest_tag=${GITHUB_REF#refs/*/}
bash ./hack/autoversion.sh ${latest_tag}


- name: Push release notes
id: push_directory
uses: cpina/github-action-push-to-another-repository@v1.7.2
Expand Down
27 changes: 24 additions & 3 deletions hack/autoversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ set -o errexit
set -o nounset
set -o pipefail

LATEST_TAG=${1:-"NONE"}



KUBEAN_VERSION=$(git describe --tags "$(git rev-list --tags --max-count=1)")
SUPPORTED_FILE_PATH="./docs/zh/usage/support_k8s_version.md"

Expand Down Expand Up @@ -34,14 +38,24 @@ function get_k8s_version_range() {
# get versionRange string
range=$(cat manifest.cr.yaml| yq '.spec.components[] | select(.name=="kube")' | yq '.versionRange' | tr '"' "'")
# replace each - with <br\/> -, divide into one line, remove \n and remove the first <br\/>
echo "$range" | sed 's/-/<br\/> -/g'|sed ':a;N;$!ba;s/\n/ /g'| sed 's/<br\/> //'
if [[ "$LATEST_TAG" == "NONE" ]]; then
echo "$range" | sed 's/-/<br\/> -/g'|sed ':a;N;$!ba;s/\n/ /g'| sed 's/<br\/> //'
else
# replace each - with &nbsp; , divide into one line, remove \n and remove the first &nbsp;
echo "$range" | sed 's/-/ \&nbsp\; /g'|sed ':a;N;$!ba;s/\n/ /g'| sed 's/ \&nbsp\; //'
fi

}

# print tab content
function k8s_version_tab_render() {
#printf -- "| %-13s | %-24s | %s |\n" 'kubean Version' 'Default Kubernetes Version' 'Supported Kubernetes Version Range'
#printf -- "| %-13s| %-24s| %s|\n" '-----------' '----------------------' '------------------------------------------------------------'
printf -- "| %-13s | %-24s| %s|\n" "$KUBEAN_VERSION" "$k8s_default_version" "$k8s_version_range"
if [[ "$LATEST_TAG" == "NONE" ]]; then
printf -- "| %-13s | %-24s| %s|\n" "$KUBEAN_VERSION" "$k8s_default_version" "$k8s_version_range"
else
printf -- "| %-24s| %s|\n" "$k8s_default_version" "$k8s_version_range"
fi
}

#############################################################################
Expand All @@ -53,5 +67,12 @@ k8s_version_range=$(get_k8s_version_range)
echo "k8s_version_range: ${k8s_version_range}"

rm -rf manifest.cr.yaml
if [[ "$LATEST_TAG" == "NONE" ]]; then
k8s_version_tab_render >> "$SUPPORTED_FILE_PATH"
else
echo "| Default Kubernetes Version | Supported Kubernetes Version Range |" >> docs/overrides/releases/${LATEST_TAG}.md
echo "| ---------------------------| ---------------------------------------------------------------------|" >> docs/overrides/releases/${LATEST_TAG}.md
k8s_version_tab_render >> docs/overrides/releases/${LATEST_TAG}.md
fi


k8s_version_tab_render >> "$SUPPORTED_FILE_PATH"
Loading