Skip to content

Instantly share code, notes, and snippets.

@kahunacohen
Created November 18, 2020 18:20
Show Gist options
  • Save kahunacohen/03a18173f03ca2e015157bce7a8583a9 to your computer and use it in GitHub Desktop.
Save kahunacohen/03a18173f03ca2e015157bce7a8583a9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Sets version in package.json, commits and pushes change, then tags pushes current branch
# This can be called after deploying the actual app.
# Args:
# - version: The version to deploy
# Usage:
# $ node_tag 0.1.0
function node_tag {
jq ".version=\"$1\"" ./package.json > package.json.tmp && mv package.json.tmp package.json && \
git commit ./package.json -m "Mutate version key in package.json to $1" && \
git push && \
git tag -a $1 -m "Tagged $1" && \
git push --tags
}
@kahunacohen
Copy link
Author

function parse_ver {
local i=0
case $2 in

major)
  i=0
  ;;

minor)
  i=1
  ;;

PATTERN_N)
  i=2
  ;;

esac
echo $i
IFS="."
read -a ar <<< "$1"
echo "There are ${#ar[*]} words in the text."
echo ${ar[0]}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment