Skip to content

Commit

Permalink
docs: Add comments to get-version.sh (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish authored Sep 27, 2021
1 parent e7dd920 commit 54ab876
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/get-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/.*: //'

0 comments on commit 54ab876

Please sign in to comment.