github.com/fastly/go-fastly/v6@v6.8.0/scripts/tags.sh (about) 1 #!/bin/bash 2 set -e 3 4 # credit: https://github.com/cli/cli/blob/trunk/script/changelog 5 6 function previous_tag() { 7 current_tag="$(git describe --tags HEAD^ --abbrev=0)" 8 start_ref="HEAD" 9 10 # Find the previous release on the same branch, skipping prereleases if the 11 # current tag is a full release 12 previous_tag="" 13 while [[ -z $previous_tag || ( $previous_tag == *-* && $current_tag != *-* ) ]]; do 14 previous_tag="$(git describe --tags "$start_ref"^ --abbrev=0)" 15 start_ref="$previous_tag" 16 done 17 echo $previous_tag 18 }