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

allow to choose previous nic/chart version #5276

Merged
merged 2 commits into from
Mar 20, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 18 additions & 15 deletions .github/scripts/release-version-update.sh
Expand Up @@ -28,40 +28,43 @@ FILE_TO_UPDATE_HELM_CHART_VERSION=(
)

usage() {
echo "Usage: $0 <ic_version> <helm_chart_version>"
echo "Usage: $0 <current_ic_version> <current_helm_chart_version> <new_ic_version> <new_helm_chart_version>"
exit 1
}

if ! command -v yq > /dev/null 2>&1; then
echo "ERROR: yq command not found in \$PATH, cannot continue, exiting..."
exit 2
current_ic_version=$1
current_helm_chart_version=$2
new_ic_version=$3
new_helm_chart_version=$4

if [ -z "${current_ic_version}" ]; then
usage
fi

ic_version=$1
helm_chart_version=$2
if [ -z "${current_helm_chart_version}" ]; then
usage
fi

if [ -z "${ic_version}" ]; then
if [ -z "${new_ic_version}" ]; then
usage
fi

if [ -z "${helm_chart_version}" ]; then
if [ -z "${new_helm_chart_version}" ]; then
usage
fi

current_ic_version=$(yq '.appVersion' <"${HELM_CHART_PATH}/Chart.yaml")
escaped_current_ic_version=$(printf '%s' "$current_ic_version" | sed -e 's/\./\\./g');
current_helm_chart_version=$(yq '.version' <"${HELM_CHART_PATH}/Chart.yaml")
escaped_current_helm_chart_version=$(printf '%s' "$current_helm_chart_version" | sed -e 's/\./\\./g');

echo "Updating versions: "
echo "ic_version: ${current_ic_version} -> ${ic_version}"
echo "helm_chart_version: ${current_helm_chart_version} -> ${helm_chart_version}"
echo "ic_version: ${current_ic_version} -> ${new_ic_version}"
echo "helm_chart_version: ${current_helm_chart_version} -> ${new_helm_chart_version}"

regex_ic="s#$escaped_current_ic_version#$ic_version#g"
regex_helm="s#$escaped_current_helm_chart_version#$helm_chart_version#g"
regex_ic="s#$escaped_current_ic_version#$new_ic_version#g"
regex_helm="s#$escaped_current_helm_chart_version#$new_helm_chart_version#g"

mv "${HELM_CHART_PATH}/values.schema.json" "${TMPDIR}/"
jq --arg version "${ic_version}" \
jq --arg version "${new_ic_version}" \
'.properties.controller.properties.image.properties.tag.default = $version | .properties.controller.properties.image.properties.tag.examples[0] = $version | .properties.controller.examples[0].image.tag = $version | .properties.controller.properties.image.examples[0].tag = $version | .examples[0].controller.image.tag = $version' \
${TMPDIR}/values.schema.json \
> "${HELM_CHART_PATH}/values.schema.json"
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/release-pr.yml
Expand Up @@ -3,14 +3,22 @@ name: Release PR
on:
workflow_dispatch:
inputs:
version:
current_version:
description: "Current version to replace"
required: true
default: "3.3.2"
new_version:
description: "Version to release"
required: true
default: "0.0.0"
helm_version:
default: "3.4.3"
current_helm_version:
description: "Current helm version to replace"
required: true
default: "1.0.2"
new_helm_version:
description: "Helm version to release"
required: true
default: "0.0.0"
default: "1.1.3"
k8s_versions:
description: "Kubernetes versions this release has been tested on"
required: true
Expand Down Expand Up @@ -48,16 +56,16 @@ jobs:

- name: Replace
run: |
.github/scripts/release-version-update.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.helm_version }}
.github/scripts/release-notes-update.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.helm_version }} "${{ github.event.inputs.k8s_versions }}" "${{ github.event.inputs.release_date }}"
.github/scripts/release-version-update.sh ${{ github.event.inputs.current_version }} ${{ github.event.inputs.current_helm_version }} ${{ github.event.inputs.new_version }} ${{ github.event.inputs.new_helm_version }}
.github/scripts/release-notes-update.sh ${{ github.event.inputs.new_version }} ${{ github.event.inputs.new_helm_version }} "${{ github.event.inputs.k8s_versions }}" "${{ github.event.inputs.release_date }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6.0.2
with:
token: ${{ secrets.NGINX_PAT }}
commit-message: Release ${{ github.event.inputs.version }}
title: Release ${{ github.event.inputs.version }}
branch: docs/release-${{ github.event.inputs.version }}
commit-message: Release ${{ github.event.inputs.new_version }}
title: Release ${{ github.event.inputs.new_version }}
branch: docs/release-${{ github.event.inputs.new_version }}
author: nginx-bot <integrations@nginx.com>
body: |
This automated PR updates the docs for ${{ github.event.inputs.version }} release.
This automated PR updates the docs for ${{ github.event.inputs.new_version }} release.