Skip to content

Instantly share code, notes, and snippets.

@stctheproducer
Created January 9, 2021 00:04
Show Gist options
  • Save stctheproducer/8ce7ecff2930d014dc6eeeba417b2239 to your computer and use it in GitHub Desktop.
Save stctheproducer/8ce7ecff2930d014dc6eeeba417b2239 to your computer and use it in GitHub Desktop.
A pre-commit hook that bumps the version of the project
#!/bin/sh
# Go to git root
path=`git rev-parse --show-toplevel`
cd "$path"
version=`docker run --rm -v "$(pwd):/repo" gittools/gitversion:5.6.3-alpine.3.12-x64-5.0 /repo /showvariable SemVer`
echo $version > VERSION
exitCode=0
json -I -f package.json -e 'this.version="'$version'"'
git add .
exit $exitCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment