diff --git a/.github/workflows/get-version.sh b/.github/workflows/get-version.sh index 78bc6e1..8eb6ab7 100755 --- a/.github/workflows/get-version.sh +++ b/.github/workflows/get-version.sh @@ -16,7 +16,17 @@ # Pull a tag or version number from versions.txt. +# Get the directory this script is in. dir=$(dirname "$0") +# Get the key we want to look for in versions.txt. +# This is the first (and only) argument to the script. key="$1" +# 1. "cat" will output the text file to stdout. +# 2. "grep" will filter for a line that begins with the desired key, +# and only send matching lines to stdout. +# ("^" is the regex character for "beginning of line") +# 3. "sed" will transform the output of grep by removing everything up to +# and including the colon and space characters, leaving only the value +# as output to stdout. cat "$dir"/versions.txt | grep "^$key:" | sed -e 's/.*: //'