Skip to content

Instantly share code, notes, and snippets.

@fabioricali
Last active September 26, 2017 16:59
Show Gist options
  • Save fabioricali/b387cc690658b065d2a9ced7d2f16727 to your computer and use it in GitHub Desktop.
Save fabioricali/b387cc690658b065d2a9ced7d2f16727 to your computer and use it in GitHub Desktop.
Read version from package.json and add tag to git
#!/usr/bin/env bash
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')
git commit -a -m "v$PACKAGE_VERSION"
git tag -a "v$PACKAGE_VERSION" -m "v$PACKAGE_VERSION"
git push --follow-tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment