#!/bin/bash

printf "%b" "#!/bin/bash

MESSAGE=\$(git log --format=%B -n 1 HEAD)

VERSION=\$(echo \$MESSAGE | grep \"v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\")

if [ \"\$VERSION\" != \"\" ]; then
  echo \"=================\"
  echo \"HEX PUBLISH \$VERSION\"
  echo \"=================\"
  mix hex.publish
else
  echo \"Continue making the app awesome.\"
fi

" > .git/hooks/post-commit

chmod 755 .git/hooks/post-commit