Deploy blog changes to FTP server on git push

Photo by Yancy Min

This blog moved to Pelican Static Site Generator some time ago. One of the problems was automation of updates on FTP server when things are added or changed.

I decided to create some Docker image with Pelican pre-installed. That way I could call all pelican tasks on GNU Linux and Windows systems. I've lost some time and failed (I haven't tried hard enough). But then another idea arrived. GitHub Actions was one of them. What I see right now - it works pretty well. When I push master branch to GitHub it builds everything and transfer files to FTP.

Create a file .github/workflows/main.yml with following content:

Go to GitHub repository settings to Secrets section. Create few new Action secrets with appropriate values: ftp_host, ftp_password, ftp_username, localdir.

For localdir I've used ./output value as a source directory to copy files from.

Those secrets are available in the main.yml under ${{ secrets.ftp_username }} keys.

Photo by Yancy Min on Unsplash