X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=hooks%2Fpost-update.dist;h=3d4099c4e4731dfd8097ee7cb4d299f71cfb88bb;hp=41590ea2764bb0e0ba9bd58c6af3a848dafcf4a8;hb=7a0c1b7e33a346195caebfdfa6489e7c6d0457e6;hpb=ec58aacc694a2b252e5903025789b079fac4378b diff --git a/hooks/post-update.dist b/hooks/post-update.dist index 41590ea2..3d4099c4 100755 --- a/hooks/post-update.dist +++ b/hooks/post-update.dist @@ -1,2 +1,18 @@ +## V1: #!/bin/sh +# NOTE: the ssh part is not required if git repo and vchess are on the same server ssh user@server -t 'cd /path/to/vchess/client && git pull && npm run build' + +## V2: +#!/bin/sh +cd /path/to/vchess || exit +# See https://stackoverflow.com/questions/4043609/getting-fatal-not-a-git-repository-when-using-post-update-hook-to-execut +unset GIT_DIR +git pull +clientLines=`git diff-tree --no-commit-id --name-only -r HEAD | grep client | wc -l` +if [ $clientLines -ne 0 ]; then + cd client + npm run build +fi + +# NOTE: should also restart the service if server code changes