Debian Codegraph @

internal/testing/git_tag_modules.sh

raw
1 #!/usr/bin/env bash
2 # Copyright 2021 The Go Cloud Development Kit Authors
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 # https://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 # This script should be run from the root directory.
17 # It creates git tags for all marked modules listed in the allmodules file.
18 set -euo pipefail
19
20 function usage() {
21 echo
22 echo "Usage: git_tag_modules.sh vX.X.X" 1>&2
23 echo " vX.X.X: the git tag version"
24 exit 64
25 }
26
27 if [[ $# -ne 1 ]] ; then
28 echo "Need at least one argument"
29 usage
30 fi
31 version="$1"
32
33 sed -e '/^#/d' -e '/^$/d' allmodules | awk '{ print $1, $2}' | while read -r path update || [[ -n "$path" ]] ; do
34 if [[ "$update" != "yes" ]]; then
35 echo "$path is not marked to be released"
36 continue
37 fi
38
39 tag="$version"
40 if [[ "$path" != "." ]]; then
41 tag="$path/$version"
42 fi
43 echo "Creating tag: ${tag}"
44 git tag "$tag"
45 done