Second try on automatic deployment of Zola based blog to Cloudflare Pages
I found a bug in Zola preventing me from using the full text search index on the hungarian version of my blog. So I patched elasticlunr-rs and Zola to support the hungarian language:
and created a custom Zola docker image based on this version: ghcr.io/sapati/zola:v0.17.1-hu
In the first post I used a workaround to deploy to Cloudflare Pages:
I did run the zola
command locally on my machine and pushed the
resulting public
directory to GitHub as well. This way Cloudflare
could simply pull the public directory from my repository.
Now I switched to a GitHub Actions based solution, and disabled the automatic deployment on Cloudflare Pages:
name: deploy
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run zola build
run: docker run -v ${{ github.workspace }}:/app ghcr.io/sapati/zola:v0.17.1-hu -r app build
- name: Deploy to Cloudflare Workers with Wrangler
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_TOKEN }}
command: pages publish public --project-name my-projects-name
The zola build step starts my custom zola image, mounts the source code as a volume into the app
directory and runs zola with -r app build
parameters to build the project.
The next step uses Cloudflare's wrangler
utility to upload the site to Cloudflare Pages.