Skip to content

Commit

Permalink
Add release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pleshakov authored and Dean-Coakley committed Sep 25, 2019
1 parent 9aed3b9 commit 0a56aee
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hack/changelog-template.txt
Original file line number Diff line number Diff line change
@@ -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.
27 changes: 27 additions & 0 deletions hack/prepare-minor-release-in-master.sh
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions hack/prepare-minor-release.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0a56aee

Please sign in to comment.