Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2019 16:57
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Git pre-commit hook to sync version number in MTA.yaml and package.json
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
# To enable this hook, rename this file to "pre-commit".
new_version=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
sed -i '' -e "s/^version: .*/version: $new_version/g" mta.yaml
git add mta.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment