I wrote a python module Git Deployer. It allows me to automate the deployment of generated static sites (documentation, help guides, etc.) using Git.
My use case
I’m using Sphinx to generate documentation. And I need to deploy the generated static files from _build/html
to my server.
On the server side I have created ‘bare’ Git repo with post-receive
hook:
#!/bin/sh
GIT_WORK_TREE=/var/www/my_domain/html/help git checkout -f main.
When I push to this repo, it automatically deploys to a website folder.
I’m working in VS Code. I’ve installed Git Deployer with pip:
python -m pip install git+https://github.com/optinsoft/git-deployer.git
In the project’s folder I’ve created deploy_config.yml
:
deploy:
remote:
name: 'myserver'
url: 'ssh://user@myserver/~/help.git'
branch: 'master'
name: owner_name
email: owner@email
message: 'new commit at %Y-%m-%d %H:%M:%S'
git_init: True
force_push: True
Now I can deploy _build/html
with a single command:
deploy _build/html