Deployment - Git, post-receive and npm run build

This is not quite related to frontity, but I’ve deployed a frontity app successfully and everything is working great. I just quickly put it up on some hosting so I can share it with people during development.

I just wondered if anyone had any experience deploying to a remote and then rebuilding frontity?

Currently I have the git remote setup correctly and that is being pulled into the site, but nothing is changing because I need to rebuild frontity.

Any help or examples are greatly appreciated!

  • EpicWebs

I got it working in the end, using a post-receive hook for git. I had the wrong line endings so it just cause a failed error which I had no clue what was going on. I got it working on a digitalocean droplet.

For anyone interested, I used something along the lines of the following:

cd /var/www/website

git --git-dir=/opt/.git --work-tree=/var/www/website checkout main -f

npm install \
&& npm run build \
&& (pm2 delete frontity || true) \
&& pm2 start npm --name "frontity" -- run serve -- --port 3001 \
&& pm2 save --force \

Good luck!