This is a basic yaml pipeline used in GitHub Actions in order to build this Hugo site and deploys it. After every commit to the main branch, this process converts markdown files to HTML using the Hugo build actions then deploys the updated site to an App Engine on Google Cloud Provider.

For GCP authentication we followed this walkthrough to setup the workload identity provider. Then we simply place the following yml file into our dotfiles at .github\workflows\google.yml, replacing the authentication variables.

name: Build and Deploy to GCP

on:
  push:
    branches: [ "main" ]

jobs:
  run-app-engine:
    name: Run App Engine
    runs-on: ubuntu-latest

    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        submodules: recursive #Ensure we download templates
        fetch-depth: 0 #Pull entire file history
    
    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2

    - name: Build
      run: |
        hugo --minify --gc         

    - id: 'auth'
      name: 'Authenticate to Google Cloud'
      uses: 'google-github-actions/auth@v1'
      with:
        workload_identity_provider: '{workload_identity_provider}'
        service_account: '{service_account}'
        project_id: '{project_id}'
    
    - name: 'Set up Cloud SDK'
      uses: 'google-github-actions/setup-gcloud@v1'

    - id: 'deploy'
      name: 'Deploy to App Engine'
      uses: 'google-github-actions/deploy-appengine@v1'
      with:
        project_id: '{project_id}'