-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·50 lines (36 loc) · 1.56 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Tools needed to run this
# yq - YAML CLI
# gh - GitHub CLI
# Prepare helm chart
VERSION=$1
git checkout -b "release-v${VERSION}"
yq -i ".version = \"${VERSION}\"" charts/cluster-secret/Chart.yaml
yq -i ".appVersion = \"${VERSION}\"" charts/cluster-secret/Chart.yaml
make helm
yq -i ".controllerManager.manager.image.tag = \"v${VERSION}\"" charts/cluster-secret/values.yaml
# Build docker image
make docker-buildx IMG="public.ecr.aws/chistadata/cluster-secret-operator:v${VERSION}"
# Package the helm chart
helm package charts/cluster-secret
helm repo index . --url "https://github.com/ChistaDATA/cluster-secret-operator/releases/download/v${VERSION}/" --merge docs/index.yaml
cp -f index.yaml docs/index.yaml
rm -f index.yaml
# Clean up bad values
sed -i '' '/creationTimestamp/d' config/rbac/role.yaml
sed -i '' '/creationTimestamp/d' config/crd/bases/chistadata.io_clustersecrets.yaml
# Push release changes to the repo
git add charts/cluster-secret/Chart.yaml
git add charts/cluster-secret/values.yaml
git add docs/index.yaml
git commit -m "Release v${VERSION}"
git push origin "release-v${VERSION}"
echo "Creating PR to merge from release-v${VERSION} to main"
gh pr create -t "Release v${VERSION}" -B "main" -b "Release v${VERSION}"
echo "Performing squash merge from release-v${VERSION} to main"
gh pr merge --admin -s
# Create GitHub release
git tag "v${VERSION}"
git push origin "v${VERSION}"
gh release create --generate-notes --verify-tag -R ChistaDATA/cluster-secret-operator "v${VERSION}" "cluster-secret-${VERSION}.tgz"
rm -f "cluster-secret-${VERSION}.tgz"