@@ -24,6 +24,8 @@ usage ()
24
24
25
25
if [[ $# -lt 1 ]]; then usage; fi
26
26
SCHEMA_VERSION=$1
27
+ FIRST_DIGIT=" ${SCHEMA_VERSION%% .* } "
28
+ RELEASE_BRANCH=" release-v${FIRST_DIGIT} "
27
29
28
30
if ! command -v hub > /dev/null; then
29
31
echo " [ERROR] The hub CLI needs to be installed. See https://github.com/github/hub/releases"
@@ -70,21 +72,21 @@ updateVersionNumbers() {
70
72
SHORT_UNAME=$( uname -s)
71
73
72
74
# # Updating version.md based off of operating system
73
- if [ " $( uname) " == " Darwin" ]; then
74
- sed -i ' ' " s/^.*$/$SCHEMA_VERSION /" VERSION
75
- elif [ " ${SHORT_UNAME: 0: 5} " == " Linux" ]; then
76
- sed -i " s/^.*$/$SCHEMA_VERSION /" VERSION
77
- fi
75
+ if [ " $( uname) " == " Darwin" ]; then
76
+ sed -i ' ' " s/^.*$/$SCHEMA_VERSION /" VERSION
77
+ elif [ " ${SHORT_UNAME: 0: 5} " == " Linux" ]; then
78
+ sed -i " s/^.*$/$SCHEMA_VERSION /" VERSION
79
+ fi
78
80
79
81
# # Remaining version number updates to yaml files
80
- yq eval " .metadata.annotations.containerImage = \" quay.io/devfile/registry-operator:$SCHEMA_VERSION \" " --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml
82
+ yq eval " .metadata.annotations.containerImage = \" quay.io/devfile/registry-operator:v $SCHEMA_VERSION \" " --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml
81
83
yq eval " .metadata.name = \" registry-operator.v$SCHEMA_VERSION \" " --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml
82
84
yq eval " .spec.version = \" $SCHEMA_VERSION \" " --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml
83
85
}
84
86
85
87
exportEnvironmentVariables () {
86
88
CHANNEL=$( yq eval ' .annotations."operators.operatorframework.io.bundle.channels.v1"' ./bundle/metadata/annotations.yaml)
87
- export IMG=quay.io/devfile/registry-operator:$SCHEMA_VERSION
89
+ export IMG=quay.io/devfile/registry-operator:v $SCHEMA_VERSION
88
90
export CHANNELS=$CHANNEL
89
91
90
92
}
@@ -95,13 +97,28 @@ commitChanges() {
95
97
git commit -s -m " $1 "
96
98
git push origin $SCHEMA_VERSION
97
99
}
100
+
101
+ # Creates a new branch in the registry-operator repo for a new major release
102
+ # with the name release-vX
103
+ # # This func will be used when we have a new major release and there is no branch in the upstream repo
104
+ createNewReleaseBranch (){
105
+ git checkout -b " ${RELEASE_BRANCH} "
106
+ git push origin " ${RELEASE_BRANCH} "
107
+ hub sync
108
+ }
109
+
110
+ createPullRequest (){
111
+ echo " [INFO] Creating a PR"
112
+ hub pull-request --base ${RELEASE_BRANCH} --head ${SCHEMA_VERSION} -m " $1 "
113
+ }
98
114
99
115
main (){
100
116
checkoutToReleaseBranch
101
117
updateVersionNumbers
102
118
exportEnvironmentVariables
103
119
make bundle
104
120
commitChanges " chore(release): release version ${SCHEMA_VERSION} "
121
+ createPullRequest " v${SCHEMA_VERSION} Release"
105
122
}
106
123
107
124
main
0 commit comments