Home / docs / Deployment / Deploying with GitHub Actions

Deploying with GitHub Actions

Last updated: August 2, 2023

Deploying with GitHub Actions

Automate your deployment process with GitHub Actions workflows.

Deploying to GitHub Pages

name: Deploy to GitHub Pages

on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - 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
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
Deployment Triggers
Customize when your deployments run:
yaml
on:
  # Run on push to main branch
  push:
    branches: [ main ]
    
  # Run on pull request to main branch
  pull_request:
    branches: [ main ]
    
  # Run manually from Actions tab