github.com/lestrrat-go/jwx/v2@v2.0.21/scripts/update-mods.sh (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  TAG="$1"
     6  if [[ -z "$TAG" ]]; then
     7  	echo "tag name must be provided"
     8  fi
     9  
    10  # Make sure Changes file contains an entry for this release
    11  relentry=$(grep "$TAG" Changes | head -n 1)
    12  if [[ "$?" -ne 0 ]]; then
    13  	echo "$TAG does not exist in Changes file";
    14  	exit 1;
    15  fi
    16  
    17  reldate=${relentry#$TAG - }
    18  reldate=${reldate//['$\t\n\r']}
    19  parseddate=$(date --date="$reldate" "+%d %b %Y")
    20  
    21  if [[ "$reldate" != "$parseddate" ]]; then
    22  	echo "$TAG does not seem to exist in Changes file (wrong entry format?)";
    23  	exit 1;
    24  fi
    25  
    26  # Update dependency in ./cmd/jwx ./examples
    27  for dir in ./cmd/jwx ./examples ./bench/performance; do
    28  	echo "👉 $dir"
    29  	pushd $dir > /dev/null
    30  
    31  	go get github.com/lestrrat-go/jwx/v2@"$TAG"
    32  	go mod tidy
    33  
    34  	popd > /dev/null
    35  done