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
- In your Gitea repository, go to Settings → Actions → Secrets.
- Add a new secret named
CLOUDFLARE_API_TOKENwith your Cloudflare API Token. - Add a second secret named
CLOUDFLARE_ACCOUNT_IDwith your Cloudflare Account ID.
Step 2: Create the Workflow File
- In your Hugo project, create the folder
.gitea/workflows/. - Inside it, create a file named
deploy.yml. - Define the workflow to trigger
on: pushto themainbranch. - Add a job that:
- Checks out the repository.
- Installs the Hugo extended binary.
- Runs
hugo --minifyto build the static site into thepublic/folder. - Uses Cloudflare’s Pages deploy action (or
wrangler pages deploy) to publish thepublic/folder, authenticated with your stored secrets.
Step 3: Push and Verify
- Commit the new workflow file and push it to your Gitea repo.
- In the Gitea web UI, go to the Actions tab of your repository to watch the run in real time.
- Once the job completes successfully, check your Cloudflare Pages dashboard to confirm the new deployment went live.
- Visit your site to confirm the changes are reflected.