Skip to content

Commit d410afc

Browse files
committed
ci: Update prepare-release.sh to include helm and static manifest updates
1 parent 9206d9c commit d410afc

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

hack/prepare-release.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ VERSION=$1
77
VERSION_REGEX='v([0-9]*)\.([0-9]*)\.([0-9]*)'
88
VERSION_REGEX_SED='v\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)'
99

10+
if [ ! -z "$(git status --porcelain)" ]; then
11+
echo "working directory is dirty!"
12+
exit 1
13+
fi
14+
1015
if [ -z "$VERSION" ]; then
1116
echo "No version specified, using 'git sv next-version'"
1217
VERSION=v$(git sv next-version)
@@ -17,22 +22,34 @@ if [[ ! ($VERSION =~ $VERSION_REGEX) ]]; then
1722
exit 1
1823
fi
1924

25+
VERSION_NO_V=$(echo $VERSION | sed 's/$v//g')
26+
2027
echo VERSION=$VERSION
28+
echo VERSION_NO_V=$VERSION_NO_V
2129

2230
cat docs/install.md | sed "s/ref=$VERSION_REGEX_SED/ref=$VERSION/g" > docs/install.md.tmp
2331
mv docs/install.md.tmp docs/install.md
2432

25-
cat config/manager/kustomization.yaml | sed "s/$VERSION_REGEX_SED/$VERSION/g" > config/manager/kustomization.yaml.tmp
26-
mv config/manager/kustomization.yaml.tmp config/manager/kustomization.yaml
33+
SED_FILES="\
34+
docs/install.md \
35+
"
36+
ADD_FILES="$SED_FILES"
37+
38+
yq -i ".version=\"$VERSION_NO_V\" | .appVersion=\"$VERSION\"" deploy/charts/template-controller/Chart.yaml
39+
ADD_FILES="$ADD_FILES deploy/charts/template-controller/Chart.yaml"
2740

28-
FILES="docs/install.md config/manager/kustomization.yaml"
41+
for f in $SED_FILES; do
42+
echo "Replacing version in $f"
43+
cat $f | sed "s/$VERSION_REGEX_SED/$VERSION/g" > $f.tmp
44+
mv $f.tmp $f
45+
done
2946

30-
for f in $FILES; do
47+
for f in $ADD_FILES; do
3148
git add $f
3249
done
3350

3451
echo "committing"
35-
git commit -o -m "build: Preparing release $VERSION" -- $FILES
52+
git commit -o -m "build: Preparing release $VERSION" -- $ADD_FILES
3653

3754
echo "tagging"
3855
git tag -f $VERSION

0 commit comments

Comments
 (0)