diff --git a/.github/ISSUE_TEMPLATE/new-release.md b/.github/ISSUE_TEMPLATE/new-release.md index 8ea7d7ae4..53e649560 100644 --- a/.github/ISSUE_TEMPLATE/new-release.md +++ b/.github/ISSUE_TEMPLATE/new-release.md @@ -21,6 +21,10 @@ future releases. - [ ] Sync/tidy up dependencies. - [ ] Run `go mod tidy`. - [ ] Run `git commit -m 'go.mod,go.sum: update dependencies.' go.{mod,sum}`, if necessary. + - [ ] Update deployment files + - [ ] run `hack/release-helper.sh` + - [ ] commit changes, submit as a PR to GitHub + - [ ] wait for the PR to be merged - [ ] Run `git tag -a -m "NRI plugins $VERSION" $VERSION`. - Publishing - [ ] Push the tag with `git push $VERSION`. diff --git a/hack/release-helper.sh b/hack/release-helper.sh new file mode 100644 index 000000000..5c78f4513 --- /dev/null +++ b/hack/release-helper.sh @@ -0,0 +1,44 @@ +#!/bin/bash -e +set -o pipefail + +this=`basename $0` + +usage () { +cat << EOF +Usage: $this VERSION + +Example: + + $this v0.2.0 +EOF +} + +# Check args +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +version=$1 +shift 1 + +if ! [[ $version =~ ^v([0-9]+\.[0-9]+\..+)$ ]]; then + echo -e "ERROR: invalid VERSION '$version'" + exit 1 +fi +image_tag=${BASH_REMATCH[1]} + +# Patch Kustomize +echo "Patching kustomize files" +find deployment/base deployment/overlays -name '*.yaml' | xargs -I '{}' \ + sed -E -e s",newTag:.+$,newTag: $image_tag," \ + -e s",imagePullPolicy:.+$,imagePullPolicy: IfNotPresent," \ + -i '{}' + +# Patch Helm charts +echo "Patching Helm charts" +find deployment/helm -name Chart.yaml | xargs -I '{}' \ + sed -e s"/appVersion:.*/appVersion: $image_tag/" -i '{}' +find deployment/helm -name values.yaml | xargs -I '{}' \ + sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}' +