github.com/line/line-bot-sdk-go/v7@v7.21.0/script/tag.sh (about)

     1  # Copyright 2018 LINE Corporation
     2  #
     3  # LINE Corporation licenses this file to you under the Apache License,
     4  # version 2.0 (the "License"); you may not use this file except in compliance
     5  # with the License. You may obtain a copy of the License at:
     6  #
     7  #   http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    11  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    12  # License for the specific language governing permissions and limitations
    13  # under the License.
    14  #
    15  # Update and commit linebot/version.go and create a new tag.
    16  #
    17  # Usage:
    18  #   bash script/tag.sh v3.0.0
    19  
    20  if [ $# -gt 1 ]; then
    21    echo "too many arguments" > /dev/stderr
    22    echo 'Usage: tag.sh $TAG' > /dev/stderr
    23    exit 1
    24  fi
    25  
    26  if [ $# -lt 1 ]; then
    27    echo "TAG argument is required" > /dev/stderr
    28    echo 'Usage: tag.sh $TAG' > /dev/stderr
    29    exit 1
    30  fi
    31  
    32  TAG=$1
    33  echo "TAG: $TAG"
    34  VERSION=${TAG#v}
    35  
    36  if [ "$TAG" = "$VERSION" ]; then
    37    echo "TAG must start with 'v'"
    38    exit 1
    39  fi
    40  
    41  echo "cd `dirname $0`/.."
    42  cd `dirname $0`/..
    43  
    44  echo "create linebot/version.go"
    45  cat << EOS > linebot/version.go
    46  // Copyright 2016 LINE Corporation
    47  //
    48  // LINE Corporation licenses this file to you under the Apache License,
    49  // version 2.0 (the "License"); you may not use this file except in compliance
    50  // with the License. You may obtain a copy of the License at:
    51  //
    52  //   http://www.apache.org/licenses/LICENSE-2.0
    53  //
    54  // Unless required by applicable law or agreed to in writing, software
    55  // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    56  // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    57  // License for the specific language governing permissions and limitations
    58  // under the License.
    59  //
    60  // Don't edit this file directly. This file is generated by script/tag.sh .
    61  
    62  package linebot
    63  
    64  const version = "$VERSION"
    65  EOS
    66  
    67  git add linebot/version.go
    68  git commit -m "Update version to $TAG"
    69  echo "git tag $TAG"
    70  git tag $TAG