-
Clone this repository:
git clone https://github.com/m4dz/atomic-deploy-githooks.git /usr/src/atomic-deploy-githooks
-
Create a Git bare repository:
git init --bare my-repo
-
Delete existing git hooks:
cd my-repo rm -rf hooks -
Checkout deploy scripts in bare repo:
cd /usr/src/atomic-deploy-githooks git worktree add /path/to/my-repo/hooks -f main -
Initialize the project:
cd /path/to/my-repo/hooks npm ci cd .. git config dirs.deploy /path/to/production/www-root
-
Add the bare repo as a Git remote :
cd /my/awesome/project git remote add deploy www@my-container:/path/to/my-repo -
Each time you want to deploy a branch, push it to the
deployremote:git push deploy my/new-branch
See the talk about atomic deployment as Git hooks at https://m4dz.net/t/atomic-deployment-for-js/