vitess.io/vitess@v0.16.2/tools/back_to_dev_mode.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  # Copyright 2023 The Vitess Authors.
     6  #
     7  # Licensed under the Apache License, Version 2.0 (the "License");
     8  # you may not use this file except in compliance with the License.
     9  # You may obtain a copy of the License at
    10  #
    11  #     http://www.apache.org/licenses/LICENSE-2.0
    12  #
    13  # Unless required by applicable law or agreed to in writing, software
    14  # distributed under the License is distributed on an "AS IS" BASIS,
    15  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16  # See the License for the specific language governing permissions and
    17  # limitations under the License.
    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 [ "$DEV_VERSION" == "" ]; then
    43    echo "Set the env var DEV_VERSION with the next release version of this branch"
    44    exit 1
    45  fi
    46  
    47  # Putting the branch back into dev mode
    48  function doBackToDevMode () {
    49    # Preparing the "dev mode" commit
    50    updateJava $DEV_VERSION
    51    updateDockerReleaseScript $DEV_VERSION
    52    updateVersionGo $DEV_VERSION
    53  
    54    git add --all
    55    git commit -n -s -m "Back to dev mode"
    56  }
    57  
    58  checkGitState
    59  
    60  current_branch=""
    61  checkoutNewBranch "back_to_dev"
    62  
    63  doBackToDevMode
    64  
    65  echo " "
    66  echo " "
    67  echo "----------------"
    68  echo "Back-to-dev mode successful."
    69  echo " "
    70  echo "One branch created: $current_branch"
    71  echo " "
    72  echo "Please push $current_branch to a remote. You will then create a Pull Request to merge into $BASE_REMOTE:$BASE_BRANCH."
    73  echo " "
    74  echo "   git push upstream $current_branch"
    75  echo " "
    76  echo " "
    77  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."
    78  echo " "
    79  echo "   gh pr create -w --title 'Back to dev mode after v$RELEASE_VERSION' --base $BASE_BRANCH --head USER_ON_WHICH_YOU_PUSHED:$current_branch --label 'Type: Release','Component: General' --body 'Includes the changes required to go back into dev mode (v$DEV_VERSION) after the release of v$RELEASE_VERSION.'"
    80  echo " "
    81  echo "----------------"