diff --git a/hack/changelog-template.txt b/hack/changelog-template.txt new file mode 100644 index 0000000000..b0381335fc --- /dev/null +++ b/hack/changelog-template.txt @@ -0,0 +1,14 @@ + +### %%IC_VERSION%% + +CHANGES: +* Update NGINX version to X.Y.Z. +* Update NGINX Plus version to RX. + +HELM CHART: +* The version of the Helm chart is now %%HELM_CHART_VERSION%%. + +UPGRADE: +* For NGINX, use the %%IC_VERSION%% image from our DockerHub: `nginx/nginx-ingress:%%IC_VERSION%%` or `nginx/nginx-ingress:%%IC_VERSION%%-alpine` +* For NGINX Plus, please build your own image using the %%IC_VERSION%% source code. +* For Helm, use version %%HELM_CHART_VERSION%% of the chart. diff --git a/hack/prepare-minor-release-in-master.sh b/hack/prepare-minor-release-in-master.sh new file mode 100755 index 0000000000..2b7c1fa11f --- /dev/null +++ b/hack/prepare-minor-release-in-master.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Updates the files required for a new minor release. Run this script in the master branch. +# +# Usage: +# hack/prepare-minor-release-in-master.sh ic-version helm-chart-version +# +# Example: +# hack/prepare-minor-release-in-master.sh 1.5.5 0.3.5 + +if [ $# != 2 ]; +then + echo "Invalid number of arguments" 1>&2 + echo "Usage: $0 ic-version helm-chart-version" 1>&2 + exit 1 +fi + +ic_version=$1 +helm_chart_version=$2 + +prev_ic_version=$(echo $ic_version | awk -F. '{ printf("%s.%s.%d", $1, $2, $3-1) }') +prev_helm_chart_version=$(echo $helm_chart_version | awk -F. '{ printf("%s.%s.%d", $1, $2, $3-1) }') + +sed -i "" "s/$prev_ic_version/$ic_version/g" README.md + +sed -i "" "1r hack/changelog-template.txt" CHANGELOG.md +sed -i "" -e "s/%%IC_VERSION%%/$ic_version/g" -e "s/%%HELM_CHART_VERSION%%/$helm_chart_version/g" CHANGELOG.md diff --git a/hack/prepare-minor-release.sh b/hack/prepare-minor-release.sh new file mode 100755 index 0000000000..b857d24d81 --- /dev/null +++ b/hack/prepare-minor-release.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# Updates the files required for a new minor release. Run this script in the release branch. +# +# Usage: +# hack/prepare-minor-release.sh ic-version helm-chart-version +# +# Example: +# hack/prepare-minor-release.sh 1.5.5 0.3.5 + +FILES_TO_UPDATE_IC_VERSION=( + Makefile + README.md + build/README.md + deployments/daemon-set/nginx-ingress.yaml + deployments/daemon-set/nginx-plus-ingress.yaml + deployments/deployment/nginx-ingress.yaml + deployments/deployment/nginx-plus-ingress.yaml + deployments/helm-chart/Chart.yaml + deployments/helm-chart/README.md + deployments/helm-chart/values-icp.yaml + deployments/helm-chart/values-plus.yaml + deployments/helm-chart/values.yaml +) + +FILE_TO_UPDATE_HELM_CHART_VERSION=( deployments/helm-chart/Chart.yaml ) + +if [ $# != 2 ]; +then + echo "Invalid number of arguments" 1>&2 + echo "Usage: $0 ic-version helm-chart-version" 1>&2 + exit 1 +fi + +ic_version=$1 +helm_chart_version=$2 + +prev_ic_version=$(echo $ic_version | awk -F. '{ printf("%s.%s.%d", $1, $2, $3-1) }') +prev_helm_chart_version=$(echo $helm_chart_version | awk -F. '{ printf("%s.%s.%d", $1, $2, $3-1) }') + +sed -i "" "s/$prev_ic_version/$ic_version/g" ${FILES_TO_UPDATE_IC_VERSION[*]} +sed -i "" "s/$prev_helm_chart_version/$helm_chart_version/g" ${FILE_TO_UPDATE_HELM_CHART_VERSION[*]} + +sed -i "" "1r hack/changelog-template.txt" CHANGELOG.md +sed -i "" -e "s/%%IC_VERSION%%/$ic_version/g" -e "s/%%HELM_CHART_VERSION%%/$helm_chart_version/g" CHANGELOG.md