github.com/Tri-stone/burrow@v0.25.0/scripts/tag_release.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  
     5  # Wait a second so we don't see ephemeral file changes
     6  sleep 1
     7  
     8  # Don't tag if there is a dirty working dir
     9  if ! git diff-index --quiet HEAD  ; then
    10      echo "Warning there appears to be uncommitted changes in the working directory:"
    11      git diff-index HEAD
    12      echo
    13      echo "Please commit them or stash them before tagging a release."
    14      echo
    15  fi
    16  
    17  version=v$(go run ./project/cmd/version/main.go)
    18  notes=$(go run ./project/cmd/notes/main.go)
    19  
    20  echo "This command will tag the current commit $(git rev-parse --short HEAD) as version $version"
    21  echo "defined programmatically in project/releases.go with release notes:"
    22  echo
    23  echo "$notes" | sed 's/^/> /'
    24  echo
    25  echo "It will then push the version tag to origin."
    26  echo
    27  read -p "Do you want to continue? [Y\n]: " -r
    28  # Just hitting return defaults to continuing
    29  [[ $REPLY ]] && [[ ! $REPLY =~ ^[Yy]$ ]] && echo && exit 0
    30  echo
    31  
    32  # Create tag
    33  echo "Tagging version $version with message:"
    34  echo ""
    35  echo "$notes"
    36  echo ""
    37  echo "$notes" | git tag -s -a ${version} -F-
    38  
    39  # Push tag
    40  git push origin ${version}
    41