github.com/yggdrasil-network/yggdrasil-go@v0.5.6/contrib/semver/name.sh (about)

     1  #!/bin/sh
     2  
     3  # Get the current branch name
     4  BRANCH="$GITHUB_REF_NAME"
     5  if [ -z "$BRANCH" ]; then
     6    BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
     7  fi
     8  
     9  if [ $? != 0 ] || [ -z "$BRANCH" ]; then
    10    printf "yggdrasil"
    11    exit 0
    12  fi
    13  
    14  # Remove "/" characters from the branch name if present
    15  BRANCH=$(echo $BRANCH | tr -d "/")
    16  
    17  # Check if the branch name is not master
    18  if [ "$BRANCH" = "master" ]; then
    19    printf "yggdrasil"
    20    exit 0
    21  fi
    22  
    23  # If it is something other than master, append it
    24  printf "yggdrasil-%s" "$BRANCH"