github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/scripts/build-schema-file.sh (about)

     1  #!/bin/sh
     2  set -euo pipefail
     3  IFS=$'\n\t'
     4  
     5  TARGET_TAG=$1
     6  TARGET_COMMIT=$(git rev-parse $TARGET_TAG)
     7  CURRENT_COMMIT=$(git rev-parse HEAD)
     8    
     9  if [ $TARGET_COMMIT != $CURRENT_COMMIT ]; then
    10      mkdir $TARGET_TAG
    11      pushd $TARGET_TAG 1>&2
    12  
    13      git clone .. . 1>&2
    14      git checkout $TARGET_TAG 1>&2
    15  fi
    16  
    17  go run . validate --output-schema
    18  
    19  if [ $TARGET_COMMIT != $CURRENT_COMMIT ]; then
    20      popd 1>&2
    21      rm -rf $TARGET_TAG
    22  fi