Overview

This is the final piece of the Hugo publishing pipeline: a Gitea Actions workflow that automatically builds the Hugo site and deploys it straight to Cloudflare Pages every time you push to your private Gitea repo. No manual builds, no manual uploads… push to main, and the live site updates itself.


Hardware / Requirements

  • A registered and running Gitea Act Runner (see my Gitea Act Runner Setup on Proxmox guide if you haven’t set this up yet).
  • A Cloudflare account with a Pages project already created and connected to your domain.
  • A Cloudflare API Token with Pages edit permissions.

🌐 Prerequisite: Generate your Cloudflare API Token and Account ID beforehand (you’ll need both to authenticate the deploy step).

Procedure

Step 1: Store Your Cloudflare Credentials as Secrets

  1. In your Gitea repository, go to Settings → Actions → Secrets.
  2. Add a new secret named CLOUDFLARE_API_TOKEN with your Cloudflare API Token.
  3. Add a second secret named CLOUDFLARE_ACCOUNT_ID with your Cloudflare Account ID.

Step 2: Create the Workflow File

  1. In your Hugo project, create the folder .gitea/workflows/.
  2. Inside it, create a file named deploy.yml.
  3. Define the workflow to trigger on: push to the main branch.
  4. Add a job that:
  • Checks out the repository.
  • Installs the Hugo extended binary.
  • Runs hugo --minify to build the static site into the public/ folder.
  • Uses Cloudflare’s Pages deploy action (or wrangler pages deploy) to publish the public/ folder, authenticated with your stored secrets.

Step 3: Push and Verify

  1. Commit the new workflow file and push it to your Gitea repo.
  2. In the Gitea web UI, go to the Actions tab of your repository to watch the run in real time.
  3. Once the job completes successfully, check your Cloudflare Pages dashboard to confirm the new deployment went live.
  4. Visit your site to confirm the changes are reflected.