| 1 | ## V1: |
| 2 | #!/bin/sh |
| 3 | # NOTE: the ssh part is not required if git repo and vchess are on the same server |
| 4 | ssh user@server -t 'cd /path/to/vchess/client && git pull && npm run build' |
| 5 | |
| 6 | ## V2: |
| 7 | #!/bin/sh |
| 8 | cd /path/to/vchess || exit |
| 9 | # See https://stackoverflow.com/questions/4043609/getting-fatal-not-a-git-repository-when-using-post-update-hook-to-execut |
| 10 | unset GIT_DIR |
| 11 | git pull |
| 12 | clientLines=`git diff-tree --no-commit-id --name-only -r HEAD | grep client | wc -l` |
| 13 | if [ $clientLines -ne 0 ]; then |
| 14 | cd client |
| 15 | npm run build |
| 16 | fi |
| 17 | |
| 18 | # NOTE: should also restart the service if server code changes |