Skip to main content
The benson.vc site uses GitHub Pages for hosting, with automated deployments via GitHub Actions. Every push to the main branch triggers a new deployment.

How it works

The deployment process is fully automated through a GitHub Actions workflow:
  1. Code is pushed to the main branch
  2. GitHub Actions triggers the workflow
  3. Hugo builds the site with minification
  4. Static files are deployed to the gh-pages branch
  5. GitHub Pages serves the site from the gh-pages branch

GitHub Actions workflow

The workflow is defined in .github/workflows/gh-pages.yml:
name: GitHub Pages

on:
  push:
    branches:
      - main

jobs:
  build-deploy:
    runs-on: ubuntu-latest
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: true
          fetch-depth: 0

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: "latest"

      - name: Build
        run: hugo --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: ${{ github.ref == 'refs/heads/main' }}
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./public

Deployment steps

The workflow performs these steps:
1

Checkout repository

Clones the repository including submodules (for the Hugo theme).
2

Setup Hugo

Installs the latest version of Hugo in the CI environment.
3

Build the site

Runs hugo --minify to generate optimized static files in the public/ directory.
4

Deploy to gh-pages

Pushes the contents of public/ to the gh-pages branch using the built-in GitHub token.

Repository settings

To enable GitHub Pages for your repository:
1

Navigate to Settings

Go to your GitHub repository and click on Settings.
2

Open Pages settings

In the left sidebar, click Pages under the “Code and automation” section.
3

Configure the source

Under “Build and deployment”, set:
  • Source: Deploy from a branch
  • Branch: gh-pages
  • Folder: / (root)
4

Save and wait

GitHub Pages will deploy your site. The URL will be shown at the top of the Pages settings.
The gh-pages branch is managed entirely by the GitHub Actions workflow. Do not manually commit to this branch, as your changes will be overwritten on the next deployment.

Monitoring deployments

You can monitor deployment status in several ways:
  • Actions tab: View workflow runs and logs in the repository’s Actions tab
  • Commit status: Check marks next to commits indicate successful deployments
  • Pages settings: Shows the current deployment status and URL

Troubleshooting

If your deployment fails:
  1. Check the workflow logs in the Actions tab for error messages
  2. Verify that the gh-pages branch exists and is set as the Pages source
  3. Ensure your Hugo build succeeds locally with hugo --minify
  4. Confirm that the CNAME file is present in static/CNAME

Manual deployment

If needed, you can manually trigger a deployment by pushing to the main branch:
git add .
git commit -m "Trigger deployment"
git push origin main
The GitHub Actions workflow will automatically run and deploy your changes.

Next steps

To use a custom domain with your GitHub Pages site, see Setting up a custom domain.

Build docs developers (and LLMs) love