|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Copyright 2023 The Bazel Authors. All rights reserved. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -o nounset |
| 17 | +set -o pipefail |
| 18 | +set -o errexit |
| 19 | + |
| 20 | +set -x |
| 21 | + |
| 22 | +TAG=${1:-} |
| 23 | +if [ -n "$TAG" ]; then |
| 24 | + # If the workflow checks out one commit, but is releasing another |
| 25 | + git fetch origin tag "$TAG" |
| 26 | + # Update our local state so the grep command below searches what we expect |
| 27 | + git checkout "$TAG" |
| 28 | +fi |
| 29 | + |
| 30 | +grep_exit_code=0 |
| 31 | +# Exclude dot directories, specifically, this file so that we don't |
| 32 | +# find the substring we're looking for in our own file. |
| 33 | +# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings. |
| 34 | +grep --exclude=CONTRIBUTING.md \ |
| 35 | + --exclude=RELEASING.md \ |
| 36 | + --exclude=release.py \ |
| 37 | + --exclude=release_test.py \ |
| 38 | + --exclude-dir=.* \ |
| 39 | + VERSION_NEXT_ -r || grep_exit_code=$? |
| 40 | + |
| 41 | +if [[ $grep_exit_code -eq 0 ]]; then |
| 42 | + echo |
| 43 | + echo "Found VERSION_NEXT markers indicating version needs to be specified" |
| 44 | + exit 1 |
| 45 | +fi |
0 commit comments