Skip to content

Instantly share code, notes, and snippets.

@beeleebow
Created June 17, 2019 10:59
Show Gist options
  • Save beeleebow/0575c867e11ac18e83b6e0ea6da4eb0f to your computer and use it in GitHub Desktop.
Save beeleebow/0575c867e11ac18e83b6e0ea6da4eb0f to your computer and use it in GitHub Desktop.
#!/bin/bash
TAGS=$(git tag --list)
IFS=$'\n' read -rd '' -a TAGS_ARRAY <<<"$TAGS"
ARR_LENGTH="${#TAGS_ARRAY[@]}"
MOST_RECENT="${TAGS_ARRAY[ARR_LENGTH - 1]}"
printf "$MOST_RECENT\n"
jq '.builder = $version' --arg version "$MOST_RECENT" test.json > temp.test.json
mv temp.test.json test.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment