I am using a static site generator called hexo to publish posts on my blog which converts markdown files into html, css and js files. Now you could manually copy these files to your webserver, but where is the fun in that? One of the ways you could automate this is using CI. More specifically in my case the system integrated into GitLab, which I have been using for years now. This is a great way to publish a static site blog which should be version-controlled anyways.
If you are not familiar with Gitlab CI I am going to walk you through the build file I am using.
In the before_script section the script checks for certain variables that should be defined in Gitlab and updates the docker container it runs in. The deploy stage first installs the openssh client and adds the ssh-key specified in the gitlab environment variables. Then the actual static site is being build, in this case by hexo. The resulting files are then transfered to the remote server to a temporary directory using scp. Finally a script is being run on the server to copy the website into appropriate folders and set the right permissions. The last two lines allow the script only to be run on the master branch.
For this to work you need the define three self-explanatory environmental variables in your gitlab repository called SSH_PRIVATE_KEY, SSH_USER, WEB_SERVER.
The default git branch I use for writing is called drafts and when I want to publish an article I create a merge request to the default main branch.
With this kind of setup it does not matter on which machine I write my posts as I can either commit to the repository or just use the builtin editor of GitLab if I wanted to.