vitess.io/vitess@v0.16.2/tools/create_release.sh (about) 1 #!/bin/bash 2 3 # Copyright 2023 The Vitess Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 set -euo pipefail 18 19 source ./build.env 20 source ./tools/release_utils.sh 21 22 ROOT=$(pwd) 23 if [ "$VTROOT" != "" ]; then 24 ROOT=$VTROOT 25 fi 26 27 if [ "$BASE_REMOTE" == "" ]; then 28 echo "Set the env var BASE_REMOTE with the name of the remote on which the release branch is located." 29 exit 1 30 fi 31 32 if [ "$BASE_BRANCH" == "" ]; then 33 echo "Set the env var BASE_BRANCH with the name of the branch on which the release will take place." 34 exit 1 35 fi 36 37 if [ "$RELEASE_VERSION" == "" ]; then 38 echo "Set the env var RELEASE_VERSION with the release version" 39 exit 1 40 fi 41 42 if [ "$VTOP_VERSION" == "" ]; then 43 echo "Warning: The VTOP_VERSION env var is not set, the Docker tag of the vitess-operator image will not be changed." 44 echo -n "If you wish to continue anyhow press enter, otherwise CTRL+C to cancel." 45 read line 46 fi 47 48 # Preparing and tagging the release 49 function createRelease () { 50 # Unfreeze the branch 51 sed -i.bak -E "s/exit (.*)/exit 0/g" ./.github/workflows/code_freeze.yml 52 rm -f ./.github/workflows/code_freeze.yml.bak 53 54 # Wait for release notes to be injected in the code base 55 echo -n Pausing so relase notes can be added. Press enter to continue 56 read line 57 58 git add --all 59 git commit -n -s -m "Release notes for $RELEASE_VERSION" || true 60 61 # Preparing the release commit 62 updateVitessExamples $RELEASE_VERSION $VTOP_VERSION 63 updateJava $RELEASE_VERSION 64 updateDockerReleaseScript $RELEASE_VERSION 65 updateVersionGo $RELEASE_VERSION 66 67 ## Create the commit for this release and tag it 68 git add --all 69 git commit -n -s -m "Release commit for $RELEASE_VERSION" 70 } 71 72 checkGitState 73 74 current_branch="" 75 checkoutNewBranch "create_release" 76 77 createRelease 78 79 echo " " 80 echo " " 81 echo "----------------" 82 echo "Release preparations successful." 83 echo " " 84 echo "One branch created: $current_branch" 85 echo " " 86 echo "Please push $current_branch to a remote. You will then create a Pull Request to merge into $BASE_REMOTE:$BASE_BRANCH." 87 echo " " 88 echo " git push upstream $current_branch" 89 echo " " 90 echo " " 91 echo "Once pushed, please execute the following gh command to create the Pull Requests. Please replace 'USER_ON_WHICH_YOU_PUSHED' with the user/org on which you pushed the two branches." 92 echo " " 93 echo " gh pr create -w --title 'Release of v$RELEASE_VERSION' --base $BASE_BRANCH --head USER_ON_WHICH_YOU_PUSHED:$current_branch --label 'Type: Release','Component: General','Do Not Merge' --body 'Includes the release notes and release commit for the v$RELEASE_VERSION release. Once this PR is merged, we will be able to tag v$RELEASE_VERSION on the merge commit.'" 94 echo " " 95 echo "----------------"