github.com/waldiirawan/apm-agent-go/v2@v2.2.2/scripts/tagversion.sh (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  SED=sed
     5  if [[ $(uname -s) == "Darwin" ]]; then SED=gsed; fi
     6  
     7  prefix=github.com/waldiirawan/apm-agent-go
     8  version=$(${SED} 's@^\s*AgentVersion = "\(.*\)"$@\1@;t;d' version.go)
     9  major_version=$(echo $version | cut -d. -f1)
    10  modules=$(for dir in $(./scripts/moduledirs.sh); do (cd $dir && go list -m); done | grep ${prefix})
    11  
    12  echo "# Create tags"
    13  for m in $modules; do
    14  	unversioned=$(echo $m | ${SED} "s@^${prefix}/\(.*\)@\1@" | $SED "s@/\?v${major_version}\$@@")
    15  	tag=$(echo "${unversioned}/v${version}" | $SED "s@^/@@")
    16  	echo git tag -s ${tag} -m v${version}
    17  done
    18  
    19  echo
    20  echo "# Push tags"
    21  echo -n git push upstream
    22  for m in $modules; do
    23  	unversioned=$(echo $m | ${SED} "s@^${prefix}/\(.*\)@\1@" | $SED "s@/\?v${major_version}\$@@")
    24  	tag=$(echo "${unversioned}/v${version}" | $SED "s@^/@@")
    25  	echo -n " ${tag}"
    26  done
    27  echo