Deploy Hugo To CloudFlare GitHub Actions Link to heading

Build and deploy a Hugo website to CloudFlare pages through GitHub Actions

name: Hugo CloudFlare Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-22.04
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: "0.119.0"
          # extended: true

      - name: Build
        run: make hugo && cd hugo &&  hugo --minify

      - name: Deploy
        uses: cloudflare/pages-action@1
        with:
          apiToken: ${{ secrets.CLOUDFAPI_TOKEN }}
          accountId: ${{ secrets.CLOUDFACCOUNT_ID }}
          projectName: celsobenedetti
          directory: ./hugo/public
          gitHubToken: ${{ secrets.GITOKEN }}