Let's setup a post-receive hook for git like this:
#!/bin/sh
git --work-tree=/path/to/www --git-dir=/path/to/git/test_CI.git checkout -f
export PATH=$PATH:/usr/bin #(<- this export does not help much)
yarn build
The first line work well, but yarn build fails, because the hook doesn't know yarn at all.
(Running yarn in my host-terminal works perfeclty, though. The host is running on Ubuntu 18.04. by the way.)
which yarn tells me the exact location of yarn:
/home/.../.nvm/versions/node/v12.18.3/bin/yarn
I can use this for the hook. But the path contains the current yarn versionnumber, which will cause other problems, once the systems gets updated.
Plus, nvm, or node or nuxt and so on won't be found next. So this is not a clever workaround.
How can you make all the things that you have access to in your teminal (not only yarn) available for the hook?