Continuous Deployment for the Poor or How to create your CD without a runner and low requirement

For this very website I needed some sort of CD but not a quite expensive one. This website only consist of HTML and CSS, so it is not very resource intensive, but still I wanted to have the benefits of a testing environment.

My testing environment is my notebook where I do all the magic. Of course I use a git for versioning purposes and a webserver to host the website. But how to get the right stuff to the right place?

I create the website in the local git copy, which consists of two branches main and develop. Yes, you guessed correctly. main is the stable version, and develop the test/development branch. Both branches are regularily pushed to the git server / central repository. Once the develop branch is in a stable, desired state I merge it into the main branch. But how to deploy it to the webserver? Here comes the fun part.

For security reasons, create a PAT. Let this token only be able to read the repository. No need to write anything. No need to read anything else. Then clone the repository at the webserver to the desired place.

git clone https://USERNAME:PAT@REPO-DOMAIN/REPO-ADDRESS

Next create a cronjob or scheduled task (or whatever you use) to update and automatically pull the main branch of the repo in a desired time range.

git pull https://USERNAME:PAT@REPO-DOMAIN/REPO-ADDRESS

Your CD should work. This only regularily pulls the main branch, so it should be at the desired state. No runner is required! I tried to do this with Project Access Tokens, but did not achieve it with them. If someone does do it, please tell me.

Previous Blog EntryNext Blog Entry


Last update: 2024-12-10