Nothing too crazy here. For an angular project, here is an example of the post-receive hook script for an angular app. You push your project to the server and it builds your app for you. Check out my previous post Git Deploy For The Win, for general instructions on how to get set up. Really the only thing that changes here is the post-receive script and serving your files from webroot/dist.
post-receive:
#!/bin/bash
TARGET="/var/www/example.com"
GIT_DIR="/home/git/example.com.git/"
BRANCH="master"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [[ $ref = refs/heads/"$BRANCH" ]];
then
echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
git --work-tree="$TARGET" --git-dir="$GIT_DIR" checkout -f
echo "--> Installing libraries..."
cd "$TARGET"
npm install
echo "--> Rebuild dist"
ng build --prod
echo "--> Restarting..."
else
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
fi
done
Make sure it is executable :
chmod +x
Now, you can develop locally using ng serve and when you're ready for something to go on the server, you push to production.