Gumulka

ein blog

Feb 19, 2019

Automatic publishing

Translations: de

First, I was thinking about how I might make it with Hooks to deliver a site automatically, but the thing that Git does not allows to me in a Bare repo to check things out and to a checked out Repo I can't push, makes it a little more complicated.

Since I have been running several runners for Gitlab for months now, it was easier to install one on my web server and give it write permissions on the folder with my blog.

All I had to do was add a target for the server to the Makefile, a Runner and write a CI script.

Makefile snippet and CI script attached:

PUBLISHDIR=/var/www/blog

server-publish:
    $(PELICAN) $(INPUTDIR) -o $(PUBLISHDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
publish:
    script:
        - rm -rf /var/www/blog/drafts/
        - make server-publish